forked from alibaba/weex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.browser.config.js
43 lines (35 loc) · 1.11 KB
/
webpack.browser.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
var path = require('path')
var fs = require('fs')
var dirPath = path.resolve(__dirname, '..', 'html5', 'runtime')
var filePath = path.join(dirPath, 'config.js')
if (!fs.existsSync(filePath)) {
var programName = require('os').platform() === 'win32' ? 'npm.cmd' : 'npm'
require('child_process').spawnSync(programName, ['run', 'build:config'])
}
var webpack = require('webpack')
var pkg = require('../package.json')
var sourceMapPlugin = new webpack.SourceMapDevToolPlugin({
test: /\.js$/
})
var version = pkg.subversion.browser
var date = new Date().toISOString().split('T')[0].replace(/\-/g, '')
var banner = `(this.nativeLog || function(s) {console.log(s)})` +
`('START WEEX HTML5: ${version} Build ${date}');`;
var bannerPlugin = new webpack.BannerPlugin(banner, {
raw: true
})
module.exports = {
entry: './html5/browser',
output: {
path: './dist',
filename: 'browser.js',
},
module: {
loaders: [
{ test: /\.js$/, loader: 'babel' },
{ test: /\.json$/, loader: 'json'},
{ test: /\.css$/, loader: 'style-loader!css-loader' }
]
},
plugins: [bannerPlugin, sourceMapPlugin]
}