Skip to content

Instantly share code, notes, and snippets.

@binyamin
Created May 21, 2019 15:55
Show Gist options
  • Save binyamin/04feb0d7012f1fca9c7240733650d635 to your computer and use it in GitHub Desktop.
Save binyamin/04feb0d7012f1fca9c7240733650d635 to your computer and use it in GitHub Desktop.
Webpack config
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