Add npm and React boilerplate
This commit is contained in:
parent
c60886b65e
commit
00d30ea36b
9 changed files with 11849 additions and 131 deletions
41
rollup.config.js
Normal file
41
rollup.config.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import nodeResolve from '@rollup/plugin-node-resolve';
|
||||
import replace from '@rollup/plugin-replace';
|
||||
import globals from 'rollup-plugin-node-globals';
|
||||
import styles from 'rollup-plugin-styles';
|
||||
import babel from '@rollup/plugin-babel';
|
||||
|
||||
const env = process.env.NODE_ENV;
|
||||
|
||||
const config = {
|
||||
input: 'src/js/components/Root.js',
|
||||
output: {
|
||||
file: 'dist/build.js',
|
||||
format: 'esm',
|
||||
sourcemap: true,
|
||||
name: 'Tofu',
|
||||
inlineDynamicImports: true,
|
||||
exports: 'auto',
|
||||
},
|
||||
plugins: [
|
||||
styles(),
|
||||
nodeResolve({
|
||||
browser: true,
|
||||
preferBuiltins: true,
|
||||
extensions: ['.js', '.ts', '.tsx'],
|
||||
}),
|
||||
commonjs({
|
||||
exclude: 'src/**',
|
||||
}),
|
||||
babel({
|
||||
'babelHelpers': 'runtime',
|
||||
}),
|
||||
globals(),
|
||||
replace({
|
||||
'process.env.NODE_ENV': JSON.stringify(env === 'production' ? 'production' : 'development'),
|
||||
'preventAssignment': true,
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
export default config;
|
||||
Loading…
Add table
Add a link
Reference in a new issue