Skip to content

Commit

Permalink
Add Quantum compilation plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Li0liQ committed Jan 10, 2018
1 parent 5bb0b28 commit bdcb982
Show file tree
Hide file tree
Showing 3 changed files with 272 additions and 306 deletions.
16 changes: 9 additions & 7 deletions fuse.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const FuseBox = require('fuse-box').FuseBox;
const { ReplacePlugin } = require('fuse-box');
const { FuseBox, ReplacePlugin, QuantumPlugin } = require('fuse-box');
const TypeHelper = require('fuse-box-typechecker').TypeHelper;
const isProduction = process.env.NODE_ENV === 'production';
const version = require('./package.json').version;
Expand All @@ -21,24 +20,27 @@ const fuse = FuseBox.init({
ReplacePlugin({
'process.env.STRICTER_VERSION': JSON.stringify(version),
}),
QuantumPlugin({
target: 'npm',
bakeApiIntoBundle: 'index',
containedAPI: true,
treeshake: true,
})
],
homeDir: 'src',
output: 'lib/$name.js',
target: 'server',
});

const bundle = fuse
.bundle('index')
.instructions(`>[index.ts]`)
.sourceMaps(true)
.target('server');
.instructions(`>[index.ts]`);

if (!isProduction) {
bundle.watch().cache(false);
}

bundle.completed(proc => {
console.log(`\x1b[36m%s\x1b[0m`, `client bundled`);
console.log(`\x1b[36m%s\x1b[0m`, `application bundled`);
typeHelper.runSync();
});

Expand Down
Loading

0 comments on commit bdcb982

Please sign in to comment.