Files
deck/js/webpack.config.js
2018-05-12 12:03:47 +02:00

63 lines
1.2 KiB
JavaScript

const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
node: {
fs: 'empty',
},
entry: {
deck: './init.js',
},
output: {
filename: '[name].js',
path: __dirname + '/build'
},
resolve: {
modules: [path.resolve(__dirname), 'node_modules'],
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader"
]
}
]
},
optimization: {
splitChunks: {
cacheGroups: {
/* separate vendor chunk for node_modules and legacy scripts */
commons: {
test: /[\\/]node_modules[\\/]/,
name: "vendor",
chunks: "all"
},
legacy: {
test: /[\\/]legacy[\\/]/,
name: "vendor",
chunks: "all"
}
}
}
},
externals: {
"jquery": "jQuery"
},
plugins: [
new MiniCssExtractPlugin('css/[name].css'),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
})
]
};