Skip to content

Instantly share code, notes, and snippets.

@basarat
Created February 13, 2017 00:34
Show Gist options
  • Save basarat/169f735c898ffa651915763907d1bd24 to your computer and use it in GitHub Desktop.
Save basarat/169f735c898ffa651915763907d1bd24 to your computer and use it in GitHub Desktop.
const { FuseBox } = require('fuse-box');
const fsbx = require('fuse-box');
const box = FuseBox
.init({
tsConfig: "tsconfig.json",
homeDir: "src/",
sourceMap: {
bundleReference: "sourcemaps.js.map",
outFile: "public/build/sourcemaps.js.map",
},
outFile: "public/build/bundle.js",
plugins: [
fsbx.EnvPlugin({ NODE_ENV: process.argv[2] }),
!process.argv.includes('dev') && fsbx.UglifyJSPlugin()
]
})
if (process.argv.includes('dev')){
box.devServer('>app.tsx', {
port: 9966,
root : './public'
})
}
else {
box.bundle('>app.tsx')
}
/// Usage
// node fuse dev
// node fuse production
// node fuse test
// etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment