2019-03-18 19:15:31 +03:00
|
|
|
const path = require('path');
|
|
|
|
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
2019-07-01 22:08:01 +03:00
|
|
|
const StyleLintPlugin = require('stylelint-webpack-plugin');
|
2019-07-17 13:21:46 +03:00
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
2019-03-18 19:15:31 +03:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: {
|
2019-05-27 21:45:26 +03:00
|
|
|
text: path.join(__dirname, 'src', 'main.js'),
|
2019-04-13 21:28:28 +03:00
|
|
|
files: path.join(__dirname, 'src', 'files.js'),
|
2019-05-14 10:33:45 +03:00
|
|
|
public: path.join(__dirname, 'src', 'public.js'),
|
2019-03-18 19:15:31 +03:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, './js'),
|
|
|
|
publicPath: '/js/',
|
|
|
|
filename: '[name].js',
|
2019-07-17 13:21:46 +03:00
|
|
|
chunkFilename: '[name].js?v=[contenthash]'
|
2019-03-18 19:15:31 +03:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
2019-06-11 11:40:35 +03:00
|
|
|
{
|
|
|
|
test: /\.(js|vue)$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: 'eslint-loader',
|
|
|
|
enforce: 'pre'
|
|
|
|
},
|
2019-03-18 19:15:31 +03:00
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
'vue-style-loader',
|
|
|
|
'css-loader'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
|
|
|
use: [
|
|
|
|
'vue-style-loader',
|
|
|
|
'css-loader',
|
|
|
|
'sass-loader'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
|
|
|
loader: 'vue-loader'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
exclude: /node_modules/
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpg|gif|svg)$/,
|
2019-05-27 21:45:26 +03:00
|
|
|
loader: 'url-loader'
|
2019-03-18 19:15:31 +03:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2019-07-01 22:08:01 +03:00
|
|
|
plugins: [
|
|
|
|
new VueLoaderPlugin(),
|
|
|
|
new StyleLintPlugin({
|
|
|
|
files: ['src/**/*.vue', 'src/**/*.scss', 'src/**/*.css']
|
2019-07-17 13:21:46 +03:00
|
|
|
}),
|
|
|
|
new CleanWebpackPlugin()
|
2019-07-01 22:08:01 +03:00
|
|
|
],
|
2019-03-18 19:15:31 +03:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
vue$: 'vue/dist/vue.esm.js'
|
|
|
|
},
|
|
|
|
extensions: ['*', '.js', '.vue', '.json']
|
2019-07-17 13:21:46 +03:00
|
|
|
},
|
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
cacheGroups: {
|
|
|
|
highlight: {
|
|
|
|
test: /[\\/]node_modules[\\/](hightlight\.js)[\\/]/,
|
|
|
|
},
|
|
|
|
vendors: {
|
|
|
|
test: /[\\/]node_modules[\\/]/,
|
|
|
|
reuseExistingChunk: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-18 19:15:31 +03:00
|
|
|
}
|
|
|
|
};
|