-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
executable file
·68 lines (67 loc) · 2.43 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
56
57
58
59
60
61
62
63
64
65
66
67
68
let path = require('path');
let webpack = require('webpack');
let fs = require('fs');
// 性能分析工具Perf的导入
// const Perf = require.resolve('react-addons-perf');
require('react-addons-perf');
var $ = require('jquery');
require("jquery-mousewheel")($);
require('malihu-custom-scrollbar-plugin')($);
// path
let ROOT_PATH = path.resolve(__dirname);
let SOURCE_PATH = path.resolve(ROOT_PATH, 'src');
let BUILD_PATH = path.resolve(ROOT_PATH, 'dist');
module.exports = {
entry: path.join(SOURCE_PATH, './index.js'),
devtool: '#inline-source-map',
output: {
path: BUILD_PATH,
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.js$|\.jsx$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader?presets[]=react,presets[]=es2015,presets[]=stage-1'
},
// {
// test: /\.jsx?$/,
// loaders: ['babel-loader'],
// exclude: /(node_modules|bower_components)/,
// },
// {
// test: /\.jsx?$/,
// loaders: ['babel-loader'],
// // exclude: /(node_modules|bower_components)/,
// include:SOURCE_PATH,
// },
{
test: /\.css$|\.less$/,
loaders: ['style-loader', 'css-loader', 'less-loader']
},
// {
// test: /\.jsx?$/,
// loader: 'babel',
// include: SOURCE_PATH,
// query: {
// presets: ['es2015', 'react', 'stage-1']
// }
// }
{
// 进行性能
test: require.resolve("react-addons-perf"),
loader: "expose-loader?Perf"
/*
* // expose loader 用来把模块暴露到全局变量。这个功对调试或者支持依赖其他全局库的库时很有用
* require("expose-loader?libraryName!./file.js");
* // 通过属性名 "libraryName" 暴露 file.js 的 exports 到全局上下文。
* // 在浏览器中,就将可以使用 window.libraryName 。
* */
},
{ test: /jquery-mousewheel/, loader: "imports?define=>false&this=>window" },
{ test: /malihu-custom-scrollbar-plugin/, loader: "imports?define=>false&this=>window"}
]
},
target: 'electron-renderer'
};