-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathwebpack.config.babel.js
More file actions
51 lines (47 loc) · 963 Bytes
/
Copy pathwebpack.config.babel.js
File metadata and controls
51 lines (47 loc) · 963 Bytes
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
import path from 'path';
import WXAppWebpackPlugin, { Targets } from '../src';
const ext = process.env.TEST_EXT || 'js';
const include = new RegExp('src');
export default {
entry: {
app: [`./src/${ext}/utils/bomPolyfill.js`, `./src/${ext}/app.${ext}`],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist', ext),
},
target: Targets.Wechat,
module: {
rules: [
{
test: /\.(ts|js)$/,
include,
loader: 'babel-loader',
options: {
presets: ['es2015', 'stage-0'],
babelrc: false,
}
},
{
test: /\.(wxss|wxml|json|png)$/,
type: 'javascript/auto',
include,
loader: 'file-loader',
options: {
useRelativePath: true,
name: '[name].[ext]',
}
},
],
},
plugins: [
new WXAppWebpackPlugin({
extensions: [`.${ext}`, '.js'],
}),
],
devtool: 'source-map',
resolve: {
modules: [`src/${ext}`, 'node_modules'],
extensions: ['.js', '.ts', '.json'],
},
};