mirror of https://github.com/Requarks/wiki.git
9 changed files with 497 additions and 1608 deletions
Split View
Diff Options
-
2.eslintrc.yml
-
3.gitignore
-
2dev/webpack/postcss.config.js
-
201dev/webpack/webpack.common.js
-
16dev/webpack/webpack.dev.js
-
22dev/webpack/webpack.prod.js
-
18package.json
-
83poi.config.js
-
1758yarn.lock
@ -0,0 +1,2 @@ |
|||
module.exports = { |
|||
} |
@ -0,0 +1,201 @@ |
|||
const path = require('path') |
|||
const fs = require('fs-extra') |
|||
const webpack = require('webpack') |
|||
|
|||
const CopyWebpackPlugin = require('copy-webpack-plugin') |
|||
const ProgressBarPlugin = require('progress-bar-webpack-plugin') |
|||
const ExtractTextPlugin = require('extract-text-webpack-plugin') |
|||
|
|||
const babelConfig = fs.readJsonSync(path.join(process.cwd(), '.babelrc')) |
|||
|
|||
module.exports = { |
|||
entry: './client/index.js', |
|||
output: { |
|||
path: path.join(process.cwd(), 'assets'), |
|||
pathinfo: true, |
|||
filename: 'js/[name].js', |
|||
chunkFilename: 'js/[name].chunk.js', |
|||
publicPath: '/' |
|||
}, |
|||
module: { |
|||
rules: [ |
|||
{ |
|||
test: /\.js$/, |
|||
exclude: /node_modules/, |
|||
use: [ |
|||
{ |
|||
loader: 'cache-loader', |
|||
options: { |
|||
cacheDirectory: '.webpack-cache' |
|||
} |
|||
}, |
|||
{ |
|||
loader: 'babel-loader', |
|||
options: { |
|||
...babelConfig, |
|||
cacheDirectory: true |
|||
} |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
test: /\.css$/, |
|||
use: [ |
|||
{ |
|||
loader: 'style-loader' |
|||
}, |
|||
{ |
|||
loader: 'css-loader', |
|||
options: { |
|||
autoprefixer: false, |
|||
sourceMap: false, |
|||
minimize: true |
|||
} |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
test: /\.scss$/, |
|||
use: ExtractTextPlugin.extract({ |
|||
fallback: 'style-loader', |
|||
use: [ |
|||
{ |
|||
loader: 'css-loader', |
|||
options: { |
|||
autoprefixer: false, |
|||
sourceMap: false, |
|||
minimize: true |
|||
} |
|||
}, |
|||
{ |
|||
loader: 'sass-loader', |
|||
options: { |
|||
sourceMap: false |
|||
} |
|||
} |
|||
] |
|||
}) |
|||
}, |
|||
{ |
|||
test: /\.vue$/, |
|||
loader: 'vue-loader', |
|||
options: { |
|||
loaders: { |
|||
css: [ |
|||
{ |
|||
loader: 'vue-style-loader' |
|||
}, |
|||
{ |
|||
loader: 'css-loader', |
|||
options: { |
|||
autoprefixer: false, |
|||
sourceMap: false, |
|||
minimize: true |
|||
} |
|||
} |
|||
], |
|||
scss: [ |
|||
{ |
|||
loader: 'vue-style-loader' |
|||
}, |
|||
{ |
|||
loader: 'css-loader', |
|||
options: { |
|||
autoprefixer: false, |
|||
sourceMap: false, |
|||
minimize: true |
|||
} |
|||
}, |
|||
{ |
|||
loader: 'sass-loader', |
|||
options: { |
|||
sourceMap: false |
|||
} |
|||
}, |
|||
{ |
|||
loader: 'sass-resources-loader', |
|||
options: { |
|||
resources: path.join(process.cwd(), '/client/scss/global.scss') |
|||
} |
|||
} |
|||
], |
|||
js: { |
|||
loader: 'babel-loader', |
|||
options: { |
|||
babelrc: path.join(process.cwd(), '.babelrc'), |
|||
cacheDirectory: true |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
test: /\.(png|jpg|gif)$/, |
|||
use: [ |
|||
{ |
|||
loader: 'url-loader', |
|||
options: { |
|||
limit: 8192 |
|||
} |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
test: /\.svg$/, |
|||
exclude: [ |
|||
path.join(process.cwd(), 'client/svg') |
|||
], |
|||
use: [ |
|||
{ |
|||
loader: 'file-loader', |
|||
options: { |
|||
name: '[name].[ext]', |
|||
outputPath: 'svg/' |
|||
} |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
test: /\.svg$/, |
|||
include: [ |
|||
path.join(process.cwd(), 'client/svg') |
|||
], |
|||
use: [ |
|||
{ |
|||
loader: 'raw-loader' |
|||
} |
|||
] |
|||
} |
|||
] |
|||
}, |
|||
plugins: [ |
|||
new ProgressBarPlugin({ |
|||
width: 72, |
|||
complete: '▇', |
|||
incomplete: '-' |
|||
}), |
|||
new webpack.BannerPlugin('Wiki.js - wiki.js.org - Licensed under AGPL'), |
|||
new CopyWebpackPlugin([ |
|||
{ from: 'client/static' } |
|||
], { |
|||
|
|||
}), |
|||
new ExtractTextPlugin('css/bundle.css') |
|||
], |
|||
resolve: { |
|||
symlinks: true, |
|||
alias: { |
|||
'@': path.join(process.cwd(), 'client'), |
|||
'vue$': 'vue/dist/vue.common.js' |
|||
}, |
|||
extensions: [ |
|||
'.js', |
|||
'.json', |
|||
'.vue' |
|||
], |
|||
modules: [ |
|||
'node_modules' |
|||
] |
|||
}, |
|||
target: 'web' |
|||
} |
@ -0,0 +1,16 @@ |
|||
const webpack = require('webpack') |
|||
const merge = require('webpack-merge') |
|||
|
|||
const common = require('./webpack.common.js') |
|||
|
|||
module.exports = merge(common, { |
|||
module: { |
|||
rules: [] |
|||
}, |
|||
plugins: [ |
|||
new webpack.DefinePlugin({ |
|||
'process.env.NODE_ENV': JSON.stringify('development') |
|||
}) |
|||
], |
|||
resolve: {} |
|||
}) |
@ -0,0 +1,22 @@ |
|||
const webpack = require('webpack') |
|||
const merge = require('webpack-merge') |
|||
|
|||
const CleanWebpackPlugin = require('clean-webpack-plugin') |
|||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin') |
|||
|
|||
const common = require('./webpack.common.js') |
|||
|
|||
console.info(process.cwd()) |
|||
|
|||
module.exports = merge(common, { |
|||
module: { |
|||
rules: [] |
|||
}, |
|||
plugins: [ |
|||
new CleanWebpackPlugin(['assets'], { root: process.cwd() }), |
|||
new UglifyJSPlugin(), |
|||
new webpack.DefinePlugin({ |
|||
'process.env.NODE_ENV': JSON.stringify('production') |
|||
}) |
|||
] |
|||
}) |
@ -1,83 +0,0 @@ |
|||
const path = require('path') |
|||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer') |
|||
// const _ = require('lodash')
|
|||
// const SpriteLoaderPlugin = require('svg-sprite-loader/plugin')
|
|||
|
|||
module.exports = options => ({ |
|||
entry: 'client/index.js', |
|||
dist: 'assets', |
|||
staticFolder: 'client/static', |
|||
filename: { |
|||
js: 'js/[name].js', |
|||
css: 'css/bundle.css', |
|||
images: 'images/[name].[ext]', |
|||
fonts: 'fonts/[name].[ext]', |
|||
chunk: 'js/[name].chunk.js' |
|||
}, |
|||
autoprefixer: { |
|||
browsers: [ |
|||
'last 6 Chrome major versions', |
|||
'last 6 Firefox major versions', |
|||
'last 4 Safari major versions', |
|||
'last 4 Edge major versions', |
|||
'last 3 iOS major versions', |
|||
'last 3 Android major versions', |
|||
'last 2 ChromeAndroid major versions', |
|||
'Explorer 11' |
|||
] |
|||
}, |
|||
html: false, |
|||
hash: false, |
|||
sourceMap: false, |
|||
extendWebpack (config) { |
|||
// Vue - Default SCSS Imports
|
|||
config.module.rule('vue') |
|||
.use('vue-loader') |
|||
.tap(opts => { |
|||
opts.loaders.scss.push({ |
|||
loader: 'sass-resources-loader', |
|||
options: { |
|||
resources: path.join(__dirname, './client/scss/global.scss') |
|||
} |
|||
}) |
|||
return opts |
|||
}) |
|||
|
|||
// SVG Loader
|
|||
config.module.rule('svg') |
|||
.exclude.add(path.join(__dirname, './client/svg')).end() |
|||
.use('file-loader') |
|||
.tap(opts => { |
|||
opts.name = '[name].[ext]' |
|||
opts.outputPath = 'svg/' |
|||
return opts |
|||
}) |
|||
config.module.rule('svgSymbols') |
|||
.include.add(path.join(__dirname, './client/svg')).end() |
|||
.use('raw-loader') |
|||
.loader('raw-loader') |
|||
|
|||
// config.module.rule('svg').uses.delete('file-loader')
|
|||
// config.module.rule('svg')
|
|||
// .use('svg-sprite-loader')
|
|||
// .loader('svg-sprite-loader', {
|
|||
// extract: true,
|
|||
// spriteFilename: 'svg/symbols.svg'
|
|||
// })
|
|||
// config.plugin('svg-sprite-loader')
|
|||
// .use(SpriteLoaderPlugin)
|
|||
|
|||
// Vue with Compiler Alias
|
|||
config.resolve.alias.set('vue$', 'vue/dist/vue.common.js') |
|||
|
|||
// Bundle Analyze
|
|||
if (options.analyze) { |
|||
config.plugin('analyzer').use(BundleAnalyzerPlugin, [{ |
|||
analyzerMode: 'static' |
|||
}]) |
|||
} |
|||
}, |
|||
webpack (config) { |
|||
return config |
|||
} |
|||
}) |
1758
yarn.lock
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save