-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
55 lines (48 loc) · 1.46 KB
/
webpack.config.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
var path = require('path');
var webpack = require('webpack');
// var ExtractTextPlugin = require("extract-text-webpack-plugin");
// var BrowserSyncPlugin = require('browser-sync-webpack-plugin');
// var WebpackErrorNotificationPlugin = require('webpack-error-notification');
module.exports = {
// bundle個體&其來源
entry: {
index: './src/index.js'
},
//輸出位置
output: {
path: path.resolve(__dirname, 'build'), //webpack 建置專案的路徑
// publicPath: "http://localhost:3000/build/", //css引入url時參考的路徑
filename: 'bundle.js'
},
//命名空間與副檔名省略
resolve: {
root: [],
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx', '.scss', '.css', 'config.js']
},
// Assets處理加載器
module: {
loaders: [{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'stage-0', 'react'],
plugins: ['transform-runtime']
}
}, {
test: /\.css$/,
loader: 'style-loader!css-loader?sourceMap'
}, {
test: /\.scss$/,
loader: 'style-loader!css-loader?sourceMap!sass-loader?sourceMap'
}, {
test: /\.(jpe?g|JPE?G|png|PNG|gif|GIF|svg|SVG|woff|woff2|eot|ttf)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=1024&name=[sha512:hash:base64:7].[ext]'
}]
},
devtool:'source-map',
// 自動在檔案變更時進行bundle
// watch: true,
// 插件功能
plugins: []
}