-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.common.js
More file actions
68 lines (67 loc) · 1.89 KB
/
Copy pathwebpack.config.common.js
File metadata and controls
68 lines (67 loc) · 1.89 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');
module.exports = {
context: path.resolve(__dirname, './src'),
entry: { app: './app.js' },
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist/')
},
resolve: {
alias: {
Components: path.resolve(__dirname, 'src/components/'),
Data: path.resolve(__dirname, 'src/data/'),
Stylesheets: path.resolve(__dirname, 'src/stylesheets/'),
Utilities: path.resolve(__dirname, 'src/utilities/'),
Data: path.resolve(__dirname, 'src/data/'),
// Modules: [path.resolve(__dirname, "./src"), "node_modules"]},
}
},
plugins: [
new MiniCssExtractPlugin({ filename: '[name].bundle.css' }),
new HtmlWebpackPlugin({ template: __dirname + '/src/index.html' })
],
module: {
rules: [
{
test: /\.css$/,
// exclude: [/node_modules/],
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
hmr: process.env.NODE_ENV === 'development',
},
}
, 'css-loader'
],
},
{
test: /\.(png|svg|jpg|gif)$/,
use: [{
loader: 'file-loader',
options: {
name: 'img/[name].[ext]',
}
}]
},
{
test: /\.js$/,
enforce: "pre", // preload the eshint loader before transpile
exclude: [/node_modules/],
use: [{
loader: "eslint-loader",
// options: { emitErrors: false, failOnHint: false, esversion: 6 }
options: { fix: true }
}]
},
{
test: /\.js$/,
exclude: [/node_modules/],
use: [{ loader: 'babel-loader', options: { presets: ['@babel/preset-env'] } }],
},
]
}
};