Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import commonjs from 'rollup-plugin-commonjs';
import livereload from 'rollup-plugin-livereload';
import resolve from 'rollup-plugin-node-resolve';
import serve from 'rollup-plugin-serve';
const plugins = [resolve(), commonjs()];
if (process.env.ENABLE_DEV_SERVER) {
// envar set via `yarn build:watch`
plugins.push(livereload());
plugins.push(serve({ port: 8001, contentBase: ['.'] }));
}
export default {
input: 'src/spacekit.js',
output: [
{
format: 'iife',
name: 'Spacekit',
file: 'build/spacekit.js',
},
],
plugins,
};
}),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration —
// consult the documentation for details:
// https://github.com/rollup/rollup-plugin-commonjs
resolve({
browser: true,
dedupe: importee => importee === 'svelte' || importee.startsWith('svelte/')
}),
commonjs(),
// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload('public'),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser()
],
watch: {
clearScreen: false
}
};
css: css => {
css.write('public/bundle.css');
}
}),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration —
// consult the documentation for details:
// https://github.com/rollup/rollup-plugin-commonjs
resolve(),
commonjs(),
// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload('public'),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser()
],
watch: {
clearScreen: false
}
};
hydratable: true,
emitCss: true
}),
css({
sourcemap: !production,
chunkFileNames: '[hash].css',
entryFileNames: '[hash].css'
}),
importAssets({
fileNames: '[hash].[ext]',
publicPath: publicStaticPath,
}),
bundleTree({
file: 'dist/client-tree.json'
}),
!production && livereload({
watch: 'dist/server',
delay: 750,
}),
production && terser()
],
watch: {
clearScreen: false
},
},
{
input: ['src/*.svelte'],
output: {
dir: 'dist/server',
format: 'cjs',
},
plugins: [
input: 'src/index.ts',
output: {
sourcemap: true,
file: 'dist/index.umd.js',
format: 'umd',
name: 'GSTC'
},
//context: 'null',
//moduleContext: 'null',
plugins: [
typescript({ target: 'es6' }),
resolve({
browser: true
}),
commonjs({ extensions: ['.js', '.ts'] }),
!production && livereload('dist')
]
},
{
input: 'src/index.ts',
output: {
sourcemap: true,
file: 'dist/index.esm.js',
format: 'esm'
},
plugins: [
typescript({ target: 'es6' }),
resolve({
browser: true
}),
commonjs({ extensions: ['.js', '.ts'] }),
production &&
const dev = !!process.env.ROLLUP_WATCH
export default {
input: 'src/index.js',
output: {
file: 'static/index.js',
sourcemap: dev ? 'inline' : false,
format: 'iife',
},
plugins: [
postcss({ plugins: [nested()] }),
resolve({ jsnext: true }),
commonjs(),
buble({ jsx: 'h' }),
prod && uglify(),
dev && livereload('static'),
dev && serve({
contentBase: ['static'],
historyApiFallback: true,
port: 8080,
})
]
}
output: Object.assign({}, baseConfig.output, {
file: dest,
format: "umd",
sourcemap: false
})
});
targetConfig.plugins.push(
serve({
contentBase: watchDir,
port: serverPort
})
);
targetConfig.plugins.push(
livereload({
watch: watchDir
})
);
export default targetConfig;
input: "docs-src/index.js",
output: {
sourcemap: true,
format: "iife",
name: "app",
file: "docs/bundle.js"
},
plugins: [
svelte(),
resolve(),
commonjs(),
alias({
resolve: [".svelte", "js"],
entries: [{ find: "svelte-forms-lib", replacement: path.resolve(__dirname + "/build/index") }]
}),
livereload("docs")
],
watch: {
clearScreen: false
}
};
},
plugins: [
resolve(),
copy({
targets:[
{ src: 'index.html', dest: dist }
],
copyOnce: true
}),
development && serve({
open: true,
port: 3000,
contentBase: dist,
historyApiFallback: true
}),
development && livereload({
watch: dist
}),
babel({
exclude: 'node_modules/**'
}),
postcss({
extract: `${dist}/styles.css`,
minimize: production
}),
production && terser()
]
}