Reusable Webpack configs.
npm install @rajzik/config-webpackProvides Webpack dependencies and configuration. Primarily used in unison with the
Lumos CLI.
Create file in configs folder:
configs/babel.js
``js`
modules.exports = {
plugins: [new webpack.NamedChunksPlugin()],
};
`ts`
export interface WebpackOptions {
analyzeBundle?: boolean;
buildFolder?: string;
port?: string | number;
parallel?: boolean | string | number;
root?: string;
react?: boolean;
sourceMaps?: boolean;
publicPath?: string;
srcFolder: string;
entryPoint?: string;
}
`ts`
{
analyzeBundle = false,
buildFolder = 'build',
port = 3000,
react = false,
sourceMaps = false,
srcFolder = 'src',
publicPath = '/',
root = process.cwd(),
}
- analyzeBundle
- Enable/Disable bundle analyze
- buildFolder
- Defines build folder
- port
- Defines port
- react
- Enable/Disable react usage
- sourceMaps
- Enable/Disable source map generation
- srcFolder
- Defines source code folder
- entryPoint
- Defines file which will be acting as entry point instead of index.html
- publicPath
- Defined path where to get scripts
- useful values: '/', './'
- parallel
- Settings for terser plugin
- fast AF boii
- aliasPattern
- Path alias pattern
- Do not change unless you know what are you doing
- Example:
`tsx`
import MyModule from '~/MyModule';
// this will resolve src/MyModule.[ts,js,tsx,jsx]
// or src/MyModule/index.[ts,tsx,js,jsx]
- --sourceMaps--analyze
- Enable source map generation
- --parallel
- Enable bundle analyze
- / --parallel=--buildFolder=
- Enable/sets parallel configuration
- --entryPoint=
- sets build folder
-
- sets entry point for build
- Entry point is relative to srcFolder
Example:
`bash``
lumos webpack --entryPoint=appEntry.tsx --sourceMaps --analyze --buildFolder=build