Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.plugin(
ReplacePlugin({
"process.env.HOMEPAGE": pjson.homepage ? `"${pjson.homepage}"` : "null",
}),
)
// and watch unless we're bundling for production
if (!isProduction) {
mainBundle.watch()
}
// bundle the electron renderer code
const rendererBundle = fuse
.bundle("renderer")
.instructions("> [app/index.tsx] +fuse-box-css")
.plugin(CSSPlugin())
.plugin(CopyPlugin({ useDefault: false, files: ASSETS, dest: "assets", resolve: "assets/" }))
// and watch & hot reload unless we're bundling for production
if (!isProduction) {
rendererBundle.watch()
rendererBundle.hmr()
}
// when we are finished bundling...
return fuse.run().then(() => {
if (!isProduction) {
// startup electron
spawn("node", [`${__dirname}/node_modules/electron/cli.js`, __dirname], {
stdio: "inherit",
}).on("exit", code => {
console.log(`electron process exited with code ${code}`)
// start the hot reload server
if (!isProduction) {
fuse.dev({
fallback: '../src/index.html',
port: DEV_PORT
});
}
// bundle the electron renderer code
const browser = fuse
.bundle('browser')
.target('browser@esnext')
.instructions('> example/todo/src/index.tsx')
.plugin(JSONPlugin())
.plugin(WebIndexPlugin({ template: './src/index.html' }))
.plugin(CSSPlugin({ inject: true }))
.plugin(
ReplacePlugin({
'process.env.NODE_ENV': `${process.env.NODE_ENV}`
})
);
const server = fuse
.bundle('server')
.target('server@esnext')
.instructions('> example/todo/server/index.ts -better-sqlite3');
if (!isProduction) {
server.watch(
p =>
p.indexOf(`/debe/src/`) !== -1 ||
p.indexOf(resolve(__dirname, 'server')) === 0
getConfig() {
return FuseBox.init({
homeDir: "src",
output: "dist/$name.js",
target : "browser@es5",
hash: this.isProduction,
useTypescriptCompiler : true,
plugins: [
CSSPlugin(),
SVGPlugin(),
WebIndexPlugin({
template : "src/index.html"
}),
this.isProduction && QuantumPlugin({
bakeApiIntoBundle: "app",
uglify: true,
css : true
})
]
})
}
createBundle(fuse) {
getConfig() {
return FuseBox.init({
homeDir: "src",
target: "browser@es5",
output: "dist/$name.js",
plugins: [
[SassPlugin(), CSSPlugin()],
WebIndexPlugin({
template: "src/index.html",
path: "/static"
//resolve : "/static"
})
]
});
}
async tsc() {
getConfig() {
return FuseBox.init({
homeDir: 'src',
output: 'dist/$name.js',
target: 'browser@es2015',
ensureTsConfig: false,
plugins: [
[
PostCSSPlugin([
extractMediaQuery(extractMediaQueryConfig)
]),
CSSPlugin({
outFile: (file) => `dist/${file}`
})
]
]
});
}
});