Skip to content

Instantly share code, notes, and snippets.

@nmaxcom
Created November 1, 2018 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmaxcom/bde314d0a02fa1210454f27a971e9d3b to your computer and use it in GitHub Desktop.
Save nmaxcom/bde314d0a02fa1210454f27a971e9d3b to your computer and use it in GitHub Desktop.
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const devMode = process.env.NODE_ENV !== 'production';
module.exports = {
entry: 'multi-entry-loader!',/* {
app: ['./app.js', './public/styles/custom.scss', './public/styles/*.css'],
dashboard: ['./public/dashboard/scss/style.scss'],
}, */
output: {
path: path.resolve(__dirname, 'public'),
filename: '[name].bundle.js',
},
devtool: 'source-map',
output: {
path: path.resolve(__dirname, 'public/dashboard/'),
filename: '[name].bundle.js',
},
module: {
rules: [
/* JS */
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: { presets: ['env'] },
},
],
},
/* SCSS */
{
test: /\.scss$/,
use: [
{ loader: MiniCssExtractPlugin.loader },
{ loader: 'css-loader' },
{
// Loader for webpack to process CSS with PostCSS
loader: 'postcss-loader',
options: {
plugins: function() {
return [require('autoprefixer')];
},
},
},
{ loader: 'sass-loader' },
],
},
{
test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/,
loader: 'url-loader',
options: {
limit: 10000,
},
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment