forked from WhitestormJS/whs.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompilers.js
64 lines (61 loc) · 1.51 KB
/
compilers.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
import path from 'path';
import webpack from 'webpack';
import {argv} from 'yargs';
import {config} from '../webpack.config.babel';
import {isProduction} from './utils';
import {framework} from './config';
// COMPILERS
export const FrameworkCompilerInstance = (options = {framework}) =>
name => ({
main: webpack(config({
isProduction,
src: options.framework.src,
dest: options.framework.dest,
...(argv.version ? {version: argv.version} : {})
}))
}[name]);
export const ExampleCompilerInstance = (options = {path: {ammojs: '', assets: ''}}) => (p, isDev = true) => webpack({
entry: `./examples/${p}/script.js`,
output: isDev ? {
path: '/',
filename: 'script.js'
} : {
path: path.resolve('./examples/', p),
filename: 'bundle.js'
},
module: {
loaders: [{
loader: 'babel-loader',
query: {
cacheDirectory: true,
plugins: [
// ['transform-runtime', {polyfill: false}],
'transform-object-rest-spread'
],
presets: [['es2015', {modules: false}]]
}
}]
},
plugins: [
new webpack.DefinePlugin({
'process.ammoPath': `${options.path.ammojs}`,
'process.assetsPath': `${options.path.assets}`
})
],
stats: {
colors: true,
hash: false,
version: false,
timings: false,
assets: false,
chunks: false,
modules: false,
reasons: false,
children: false,
source: false,
errors: true,
errorDetails: true,
warnings: true,
publicPath: false
}
});