This repository was archived by the owner on Feb 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwebpack.config.js
84 lines (74 loc) · 2.18 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
var path = require('path');
var webpack = require('webpack');
var ionicWebpackFactory = require(process.env.IONIC_WEBPACK_FACTORY);
var GitRevisionPlugin = require('git-revision-webpack-plugin');
var gitRevisionPlugin = new GitRevisionPlugin();
const phaserDir = path.join(__dirname, 'node_modules/phaser/');
const phaserlib = path.join(phaserDir, 'build/custom/phaser-split.js');
const pixi = path.join(phaserDir, 'build/custom/pixi.js');
const p2 = path.join(phaserDir, 'build/custom/p2.js');
const env = process.env.NODE_ENV === 'production' ? 'prod' : 'dev';
const envVars = require(`./config/${env}.json`);
module.exports = {
entry: process.env.IONIC_APP_ENTRY_POINT,
output: {
path: '{{BUILD}}',
publicPath: 'build/',
filename: process.env.IONIC_OUTPUT_JS_FILE_NAME,
devtoolModuleFilenameTemplate: ionicWebpackFactory.getSourceMapperFunction(),
},
devtool: process.env.IONIC_SOURCE_MAP_TYPE,
resolve: {
extensions: ['.ts', '.js', '.json'],
modules: [path.resolve('node_modules')],
alias: {
phaserlib: phaserlib,
'pixi.js': pixi,
'p2.js': p2
}
},
devServer: {
historyApiFallback: true
},
module: {
rules: [
{
test: /\.json$/,
loader: 'json-loader',
exclude: /node_modules/
},
{
test: /\.ts$/,
loader: process.env.IONIC_WEBPACK_LOADER,
exclude: /node_modules/
},
{
test: /\.js$/,
loader: process.env.IONIC_WEBPACK_TRANSPILE_LOADER
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.woff$|\.woff2$|\.eot$|\.ttf$|\.svg$/,
loader: 'url-loader'
}
]
},
plugins: [
ionicWebpackFactory.getIonicEnvironmentPlugin(),
new webpack.DefinePlugin({
VERSION: JSON.stringify(gitRevisionPlugin.version()),
COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()),
AUTH0_CLIENT_ID: JSON.stringify(envVars.AUTH0_CLIENT_ID)
})
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
node: {
fs: 'empty',
net: 'empty',
tls: 'empty'
}
};