Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
67 lines (66 loc) · 1.93 KB
/
Copy pathwebpack.config.js
File metadata and controls
67 lines (66 loc) · 1.93 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
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
// mode:'production', // 如果为production 则会提醒性能方面的问题 最后要分别放置
// devtool: 'inline-source-map',
entry:{
fui:'./lib/index.tsx' // FUI就是输出的文件名(库的名字),如jquery.js
},
output:{
// path:__dirname+'/dist'//错!因为其他操作系统的目录分隔符不是/
path:path.resolve(__dirname,'dist/lib'),// nodejs的目录系统
libraryTarget:'umd'//可选值:umd amd commonjs global this window
},
resolve:{
extensions:['.ts','.tsx','.js','.jsx'],
},
module:{
rules:[// 随机应变去找合适的rules
{
test: /\.tsx?$/, //匹配所有的tsx文件或者tx
loader:'awesome-typescript-loader'
},
{
test: /\.svg$/,
loader: 'svg-sprite-loader',
},
{
test: /\.s([ac])ss$/,
loader:['style-loader','css-loader','sass-loader'],
// TODO:下面的有什么用?
// use: [
// devMode ? 'style-loader' : {
// loader: MiniCssExtractPlugin.loader,
// options: {
// // publicPath: '../'
// }
// },
// 'css-loader',
// {
// loader: "sass-loader",
// options: {
// includePaths: [path.resolve(__dirname, 'stylesheets', 'include')]
// }
// }]
}
]
},
// 以下为非公有部分
// plugins:[
// new HtmlWebpackPlugin({ title:'FUI',template:'index.html' }) // 在index里动态插入js
// ],
// externals:{ // 打包的时候去除 react
// 'react':{
// commonjs:'react',
// commonjs2:'react',
// amd:'react',
// root:'React',
// },
// 'react-dom':{
// commonjs:'react-dom',
// commonjs2:'react-dom',
// amd:'react-dom',
// root:'ReactDOM',
// }
// }
}