-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.common.js
53 lines (49 loc) · 1.44 KB
/
webpack.common.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
46
47
48
49
50
51
52
53
const path = require('path');
const glob = require('glob');
const webpack = require('webpack');
const ManifestPlugin = require('webpack-manifest-plugin');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const isDev = process.env.APP_ENV === 'development';
const baseFilename = isDev ? 'bundle' : 'bundle.[contenthash]';
module.exports = {
entry: [
path.resolve(__dirname, 'src', 'index.js'),
path.resolve(__dirname, 'src', 'styles.scss'),
],
module: {
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.s[ac]ss$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
}
]
},
resolve: {
extensions: ['.js'],
},
plugins: [
new webpack.BannerPlugin({
banner: 'Copyright (c) 2020 AutomaCoin'
}),
new MiniCssExtractPlugin({
filename: `assets/css/${baseFilename}.css`,
}),
new FaviconsWebpackPlugin({
logo: './src/logo.png',
mode: 'light',
}),
new ManifestPlugin(),
],
output: {
path: path.resolve(__dirname, 'dist'),
filename: `assets/js/${baseFilename}.js`,
}
}