-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
62 lines (59 loc) · 1.97 KB
/
webpack.config.js
File metadata and controls
62 lines (59 loc) · 1.97 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
var bundler = require('nativescript-dev-webpack');
var path = require('path');
var webpack = require('webpack');
var UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
var stripConsole = require('./config/remove-console.js');
var buildEnv;
if (process.env.ENV_NODE === 'production') {
buildEnv = {
IDENTITY_URL: 'https://api-identity.guanplus.com',
RESOURCE_URL: 'https://api-accounting.guanplus.com'
};
} else if (process.env.ENV_NODE === 'stage') {
buildEnv = {
IDENTITY_URL: 'https://api-identity-stage.guanplus.com',
RESOURCE_URL: 'https://api-accounting-stage.guanplus.com'
};
} else if (process.env.ENV_NODE === 'development') {
buildEnv = {
IDENTITY_URL: 'https://api-identity-stage.guanplus.com',
RESOURCE_URL: 'https://api-accounting-stage.guanplus.com'
};
} else {
buildEnv = {
IDENTITY_URL: 'https://api-identity-stage.guanplus.com',
RESOURCE_URL: 'https://api-accounting-stage.guanplus.com'
};
}
module.exports = bundler.getConfig({
resolve: {
extensions: ["", ".webpack.js", ".web.js", "." + process.env.OS + ".js", ".js"]
},
resolveLoader: {
root: path.join(__dirname, 'node_modules'),
fallback: [
path.resolve(__dirname, 'config'),
]
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['remove-console'],
exclude: [/bundles/, /tns-core-modules/,/nativescript/
]
}, {
test: /\.(html|css)$/,
loader: 'raw-loader'
}]
},
'uglify-loader': {
mangle: false
},
plugins: [new webpack.IgnorePlugin(/^\.\/locale$/, [/moment$/]),
new webpack.DefinePlugin({
IDENTITY_URL: JSON.stringify(buildEnv.IDENTITY_URL),
RESOURCE_URL: JSON.stringify(buildEnv.RESOURCE_URL),
ENVIRONMENT: JSON.stringify(process.env.ENV_NODE)
}),
new webpack.optimize.DedupePlugin()]
});