Created
May 21, 2019 15:55
-
-
Save binyamin/04feb0d7012f1fca9c7240733650d635 to your computer and use it in GitHub Desktop.
Webpack config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpack = require('webpack'); | |
const path = require('path'); | |
const autoprefixer = require('autoprefixer'); | |
const cssnano = require('cssnano'); | |
const MiniCssExtractPlugin = require('mini-css-extract-plugin') | |
const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); | |
module.exports = { | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
include: [path.resolve(__dirname, 'src')], | |
loader: 'babel-loader', | |
options: { | |
plugins: ['syntax-dynamic-import'], | |
presets: [ | |
[ | |
'@babel/preset-env', | |
{modules: false} | |
] | |
] | |
} | |
}, | |
{ | |
test: /\.css$/, | |
use: [ | |
{ loader: 'style-loader', options: { sourceMap: true } }, | |
{ | |
loader: 'css-loader', | |
options: { | |
modules: true, | |
importLoaders: 1, | |
sourceMap: true | |
} | |
}, | |
{ | |
loader: 'postcss-loader', | |
ident: 'postcss', | |
options: { | |
plugins: function() { | |
return [autoprefixer, cssnano]; | |
} | |
} | |
}, | |
] | |
} | |
] | |
}, | |
entry: { | |
main: './public/js/main.js', | |
calendar: './public/js/calendar' | |
}, | |
output: { | |
filename: '[name].bundle.js', | |
path: path.resolve(__dirname, './public/js') | |
}, | |
mode: 'development', | |
plugins: [ | |
require('cssnano')(), | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment