forked from Zodar/inclukathon-x-etna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuse.js
46 lines (42 loc) · 1.26 KB
/
fuse.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
const path = require('path');
const {
FuseBox,
CSSPlugin,
SourceMapPlainJsPlugin,
SassPlugin,
EnvPlugin,
QuantumPlugin,
JSONPlugin,
} = require('fuse-box');
const isProduction = process.env.NODE_ENV === 'production';
const fuse = FuseBox.init({
homeDir: '.',
target: 'browser@es6',
output: 'public/compiled/$name.js',
sourceMaps: !isProduction,
useTypescriptCompiler: true,
plugins: [
EnvPlugin({NODE_ENV: isProduction ? 'production' : 'development'}),
[
SassPlugin({
header: `@import "web/media-queries";`,
importer: true,
macros: {
$cssDir: path.resolve('public/css/'),
},
outputStyle: isProduction ? 'compressed' : 'nested',
}),
CSSPlugin(),
],
!isProduction && SourceMapPlainJsPlugin(),
isProduction && QuantumPlugin(),
JSONPlugin(),
],
});
fuse.bundle('app') // name of the bundle, so name of the main file in public/root folder
.splitConfig({browser: '/'}) // app.js has to know static url to resolve other split files
.instructions(' > [web/index.tsx]'); // only application code
fuse.bundle('vendors') // bundle for dependencies only
.splitConfig({browser: '/'}) // vendors.js has to know static url to resolve other split files
.instructions(' ~ web/index.tsx'); // only external dependencies
fuse.run().then();