-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
47 lines (46 loc) · 1.02 KB
/
webpack.config.js
File metadata and controls
47 lines (46 loc) · 1.02 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
// webpack.config.js
var path = require('path')
module.exports = {
entry: './src/index.js', // 在 index 檔案後的 .js 副檔名是可選的
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
resolve: {
alias: {
components: path.resolve(__dirname, 'src/components'),
reducers: path.resolve(__dirname, 'src/reducers'),
api: path.resolve(__dirname, 'src/api')
}
},
module: {
rules: [{
test: /\.css$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}]
},{
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "sass-loader",
options: {
includePaths: ["absolute/path/a", "absolute/path/b"]
}
}]
},
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: { // 需要被轉換的語法清單
presets: ['es2015', 'react','stage-1']
}
}]
}
}