-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.common.js
91 lines (90 loc) · 1.9 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
var path = require('path');
var webpack = require('webpack');
module.exports = {
context: __dirname + '/src',
mode: 'development',
entry: {
app: './index.js',
},
output: {
path: path.join(__dirname, 'build'),
filename: 'js/[name].js',
},
resolve: {
extensions: ['.js'],
modules: [path.resolve('./src'), 'src', 'node_modules'],
alias: {
app: path.resolve(__dirname, 'src/'),
components: path.resolve(__dirname, 'src/components'),
assets: path.resolve(__dirname, 'src/assets'),
},
},
module: {
rules: [
{
exclude: /node_modules/,
test: /\.js?$/,
use: [{ loader: 'babel-loader' }],
},
{
test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.eot$|\.wav$|\.mp3$|\.tsv$|\.csv$|\.mp4$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name]-[hash:6].[ext]',
},
},
],
},
{
test: /\.html$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
},
},
],
},
{
test: /\.hbs$/,
use: [
{
loader: 'raw-loader',
},
],
},
{
test: /\.css$/,
use: [
{
loader: 'style-loader',
options: {
hmr: true,
},
},
{
loader: 'css-loader',
},
],
},
{
test: /\.sass$|\.scss$/,
use: [
{
loader: 'style-loader',
options: {
hmr: true,
},
},
{ loader: 'css-loader' },
{ loader: 'sass-loader' },
],
},
],
},
// context: path.join(__dirname, 'build'),
plugins: [new webpack.EnvironmentPlugin('NODE_ENV')],
};