-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
47 lines (44 loc) · 1.74 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
'use strict';
const fs = require('fs');
const ManifestPlugin = require('webpack-manifest-plugin');
const path = require('path');
const WebpackEmitGitrev = require('./webpack-emit-gitrev');
const outdir = path.join(__dirname, 'build');
module.exports = {
devtool: 'source-map',
entry: [
'./client/index.js',
],
module: {
loaders: [
{ test: /\.blend$/, loader: require('babylonjs-blender-loader') && 'babylonjs-blender-loader', },
// https://webpack.github.io/docs/shimming-modules.html
{ test: require.resolve('babylonjs'), loader: require('imports-loader') && require('cannon') && 'imports-loader?CANNON=cannon', },
// It’s babylonjs’s fault of saying “window.CANNON !== unefined”
// instead of “typeof CANNON !== 'undefined'” when checking for
// cannon that we have to expose cannon.
{ test: require.resolve('cannon'), loader: require('expose-loader') && 'expose-loader?CANNON' },
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: require('babel-core') && require('babel-loader') && "babel-loader",
// Load presets into config so that webdev version can
// override them.
query: Object.assign(JSON.parse(fs.readFileSync(path.join(__dirname, '.babelrc'))), {
// Request that the babel-loader not go behind our
// backs and load .babelrc when we went to all this
// trouble to manually load it ourselves.
babelrc: false,
}),
},
],
},
output: {
path: outdir,
filename: '[name].[chunkhash].js',
},
plugins: [
new ManifestPlugin(),
new WebpackEmitGitrev(),
],
};