Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function genConfig (opts) {
const config = {
input: {
input: resolve('src/index.js'),
plugins: [
flow(), // Remove flow type
node(),
cjs(),
replace({
__VERSION__: version
}),
buble(),
sizes(),
cleanup(),
strip({
// set this to `false` if you don't want to
// remove debugger statements
debugger: true,
// defaults to `[ 'console.*', 'assert.*' ]`
functions: [ 'console.log', 'assert.*', 'debug', 'alert' ],
// set this to `false` if you're not using sourcemaps –
// defaults to `true`
sourceMap: true
})
]
},
output: {
plugins : [
resolve({
jsnext: true,
main: true,
browser: true,
}),
commonjs(),
babel(),
]
};
// Add Production or Development settings to the config object
if(process.env.production){
config.sourcemap = false;
config.plugins.push(uglify());
config.plugins.push(sizes());
config.plugins.push(filesize());
} else {
config.sourcemap = true;
}
export default config;
plugins : [
resolve({
jsnext: true,
main: true,
browser: true,
}),
commonjs(),
babel(),
]
};
// Add Production or Development settings to the config object
if(process.env.production){
config.sourceMap = false;
config.plugins.push(uglify());
config.plugins.push(sizes());
config.plugins.push(filesize());
} else {
config.sourceMap = true;
}
export default config;
babel({
babelrc: false,
presets: [
[`${process.cwd()}/node_modules/babel-preset-env/lib/index`, {
targets: {
browsers: ['last 2 versions'],
node: '8.1.2'
},
modules: false
}]
],
plugins: [
`${process.cwd()}/node_modules/babel-plugin-external-helpers/lib/index`
]
}),
sizes()
],
banner: `/*
${readFileSync('./LICENSE.txt')}
*/`,
entry: 'src/client.js',
moduleName: 'ShopifyBuy',
sourceMap: true
};
}