Last active
February 7, 2020 02:52
-
-
Save Noitidart/1094a4c3ee60f38714d35752b761fd43 to your computer and use it in GitHub Desktop.
This file contains 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 MiniCssExtractPlugin = require('mini-css-extract-plugin'); | |
const CopyPlugin = require('copy-webpack-plugin'); | |
const path = require('path'); | |
module.exports.webpack = { | |
config: [ | |
{ | |
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', | |
devtool: process.env.NODE_ENV === 'production' ? undefined : 'eval-source-map', | |
entry: './assets/js/index.js', | |
output: { | |
filename: 'index.bundle.js', | |
path: path.resolve(__dirname, '../.tmp/public/js'), | |
publicPath: '/js/' | |
}, | |
plugins: [ | |
new MiniCssExtractPlugin({ | |
filename: 'index.bundle.css' | |
}), | |
new CopyPlugin([ | |
{ | |
from: './assets', | |
to: '../', | |
ignore: ['js/**/*', 'styles/**/*', '.eslintrc'] | |
}, | |
]), | |
], | |
module: { | |
rules: [ | |
{ test: /\.js$/, exclude: /node_modules|dependencies/, loader: 'babel-loader' }, | |
{ test: /\.css$/, exclude: /node_modules/, use: [{ loader: MiniCssExtractPlugin.loader }, 'css-loader'] }, | |
{ test: /\.less$/, exclude: /node_modules/, use: [{ loader: MiniCssExtractPlugin.loader }, 'css-loader', 'less-loader'] } | |
] | |
} | |
} | |
], | |
watchOptions: undefined | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment