Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
useTypescriptCompiler:true,
alias: {
'rewire-core': '~/packages/rewire-core/src',
'rewire-ui': '~/packages/rewire-ui/src',
'rewire-graphql': '~/packages/rewire-graphql/src',
'rewire-common': '~/packages/rewire-common/src',
'rewire-grid': '~/packages/rewire-grid/src'
},
plugins: [
JSONPlugin(),
EnvPlugin({ NODE_ENV: isProduction ? 'production' : 'development' }),
CSSPlugin(),
[SassPlugin(), CSSPlugin()],
WebIndexPlugin({title: 'WorkSight .Next', path: './', template: 'examples/src/index.html', target: 'index.html' }),
ImageBase64Plugin({ useDefault: true }),
isProduction && QuantumPlugin({target: 'browser', uglify: {keep_fnames: true}, treeshake: true})
],
experimentalFeatures: true
});
rimraf.sync('build');
function runDevelopmentServer() {
fuse.dev({root: 'build/', port: 3001}, (server) => {
const app = server.httpServer.app;
app.use(compression());
const dist = path.resolve('./build');
function sendFile(req, res) {
let url = req.url.split('#').shift().split('?').shift().split('/').pop();
const p = path.join(dist, url);
// const p = path.join(dist, req.url);
// paths: [path.resolve(__dirname, 'node_modules')]
}),
// TypeScriptHelpers(),
CSSResourcePlugin(),
CSSPlugin({
group: 'components.css',
inject: 'components.css'
})
]
}),
TypeScriptHelpers(),
CSSPlugin(),
WebIndexPlugin({
template: "./index.html"
}),
isProduction && QuantumPlugin({
bakeApiIntoBundle: "vendor",
uglify: true,
treeshake: true
}),
],
shim: {
jquery: {
source: "node_modules/jquery/dist/jquery.min.js",
exports: "$"
}
,tether: {
source: 'node_modules/tether/dist/js/tether.js',
exports: 'Tether'
}
}
});
let run = (production) => {
const fuse = FuseBox.init({
target: "browser@es6",
homeDir: 'src',
output: 'dist/$name.js',
runAllMatchedPlugins: true,
plugins: [
production && UglifyJSPlugin(),
production && QuantumPlugin(),
EnvPlugin({
devMode: !production
}),
HTMLPlugin(),
WebIndexPlugin({
template: './index.html'
})
]
});
fuse.bundle("vendor")
.cache(true)
.instructions('~ startup.ts');
if (!production) {
fuse.bundle("app")
.instructions(" > [startup.ts]")
.hmr()
Sparky.task('config', _ => {
fuse = new FuseBox({
homeDir: 'src',
hash: isProduction,
output: 'dist/$name.js',
cache: !isProduction,
sourceMaps: !isProduction,
target: 'browser',
plugins: [
EnvPlugin({ NODE_ENV: isProduction ? 'production' : 'development' }),
WebIndexPlugin({
title: 'React Typescript FuseBox Example',
template: 'src/index.html',
}),
isProduction &&
QuantumPlugin({
bakeApiIntoBundle: 'app',
treeshake: true,
uglify: true,
}),
],
})
app = fuse.bundle('app').instructions('>index.tsx')
})
const getConfig = target => {
return {
homeDir: 'src/',
cache: !production,
target,
output: `build/$name.js`,
useTypescriptCompiler: true,
plugins: [
EnvPlugin({ NODE_ENV: production ? 'production' : 'development' }),
production &&
QuantumPlugin({
target,
bakeApiIntoBundle: true,
treeshake: true,
uglify: {
es6: true,
},
}),
],
alias: {
'~': '~/',
},
log: {
showBundledFiles: false,
},
};
};
plugins: [
EnvPlugin({
NETWORK: process.env.NETWORK || "testrpc",
NODE_ENV: isProduction ? "production" : "development"
}),
[/components.*\.css$/, PostCSSPlugin(POSTCSS_PLUGINS), CSSModules(), CSSPlugin()],
[PostCSSPlugin(POSTCSS_PLUGINS), CSSResourcePlugin({
dist: 'build/assets',
resolve: f => `/assets/${f}`
}), CSSPlugin()],
JSONPlugin(),
WebIndexPlugin({
template: "src/ui/index.html",
path: "."
}),
isProduction && QuantumPlugin({
api: (core) => {
core.solveComputed("bn.js/lib/bn.js")
},
bakeApiIntoBundle: 'assets/app',
ensureES5 : true,
removeExportsInterop: false,
treeshake: true,
uglify: true
})
],
sourceMaps: !isProduction,
target: 'browser',
useJsNext: false
})
/*
NgAotPlugin(),
isServiceWorkerEnabled && NgSwPlugin(),
isProdBuild && NgOptimizerPlugin(),
...baseOptions.plugins,
WebIndexPlugin({
base: ENV_CONFIG_INSTANCE.host,
bundles: [vendorBundleName, appBundleName],
startingDocumentPath: 'dist/index.html',
appElement: {
name: 'pm-app',
innerHTML: 'Loading....'
},
additionalDeps: BUILD_CONFIG.dependencies as any[]
}),
isProdBuild &&
QuantumPlugin({
warnings: false,
uglify: true,
treeshake: true,
bakeApiIntoBundle: vendorBundleName,
replaceProcessEnv: false,
processPolyfill: true,
ensureES5: true
})
]
}
const serverOptions = {
...baseOptions,
target: 'server',
sourceMaps: false,
plugins: [
sourceMaps: !isProduction,
plugins: [
CSSPlugin({
group: 'style.css',
outFile: `${target}/style.css`,
minify: isProduction,
}),
CopyAllPlugin({
useDefault: true,
files: ['*.png', '*.jpg', '*.ttf', '*.mp3', '*.ogg'],
}),
!isProduction && WebIndexPlugin({
template: `${source}/index.html`,
}),
isProduction &&
QuantumPlugin({
css: true,
uglify: true,
treeshake: true,
bakeApiIntoBundle: name,
}),
],
});
if (!isProduction) {
fuse.dev();
}
const bundle = fuse.bundle(name);
if (!isProduction) {
bundle.instructions(' > app.ts').hmr().watch();
useTypescriptCompiler: true,
sourceMaps: !production,
cache: !production,
plugins: [
EnvPlugin({
NODE_ENV: production ? 'production' : 'development',
HOSTNAME,
USER,
PASSWORD,
PROTOCOL,
PORT,
ENABLED,
}),
JSONPlugin(),
production &&
QuantumPlugin({
bakeApiIntoBundle: name,
treeshake: true,
removeExportsInterop: false,
uglify: {
es6: true,
},
}),
].concat(plugins),
alias: {
'~': '~/',
'@renderer': '~/renderer/',
},
log: {
showBundledFiles: false,
clearTerminalOnBundle: true,
},
const getConfig = (target, name) => {
return {
homeDir: 'src/',
cache: !production,
target,
output: `build/$name.js`,
tsConfig: './tsconfig.json',
useTypescriptCompiler: true,
plugins: [
EnvPlugin({ NODE_ENV: production ? 'production' : 'development' }),
production &&
QuantumPlugin({
bakeApiIntoBundle: name,
treeshake: true,
removeExportsInterop: false,
uglify: {
es6: true,
},
}),
],
alias: {
'~': '~/',
},
log: {
showBundledFiles: false,
clearTerminalOnBundle: true,
},
};