-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
45 lines (43 loc) · 1.16 KB
/
webpack.config.babel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import path from 'path';
import webpack from 'webpack';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import CleanWebpackPlugin from 'clean-webpack-plugin';
const mode = (process.env.NODE_ENV === 'test' && 'development') || process.env.NODE_ENV || 'development';
const assetsPath = path.join(__dirname, 'public', 'assets');
const faviconPath = path.join(__dirname, 'favicon');
console.log(faviconPath);
module.exports = {
mode,
entry: ['./src/index.js'],
output: {
path: assetsPath,
filename: 'main.js',
publicPath: '/assets/',
},
module: {
rules: [
{
test: /(\.js)(\.scss)$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader'],
},
{
test: /\.json$/,
loader: 'json-loader',
},
],
},
plugins: [
new CleanWebpackPlugin([assetsPath]),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
}),
new CopyWebpackPlugin([{ from: faviconPath, to: path.join(assetsPath, 'favicon'), toType: 'dir' }]),
],
};