@repodog/webpack-config
v0.1.3
Published
The Repodog webpack config module.
Downloads
25
Readme
@repodog/webpack-config
The Repodog webpack config.
Install package
# terminal
npm install @repodog/webpack-config --save-dev
Install dependencies
# terminal
npm install source-map-loader webpack webpack-cli --save-dev
Install optional dependencies
# terminal
npm install babel-loader --save-dev
# or
npm install swc-loader --save-dev
Use package
// package.json
{
"scripts": {
"build": "webpack --config ./webpack.config.cjs"
}
}
With Babel
// webpack.config.cjs
const webpackConfig = require('@repodog/webpack-config');
module.exports = {
...webpackConfig({ compiler: 'babel-loader' }),
entry: './src/index.ts',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
},
};
With SWC
// webpack.config.cjs
const swcConfig = require('@repodog/swc-config');
const webpackConfig = require('@repodog/webpack-config');
module.exports = {
...webpackConfig({ compiler: ['swc-loader', swcConfig] }),
entry: './src/index.ts',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
},
};
Bundle tests
// webpack.config.cjs
const swcConfig = require('@repodog/swc-config');
const webpackConfig = require('@repodog/webpack-config/test.cjs');
module.exports = {
...webpackConfig({ compiler: 'babel-loader' })
// or
...webpackConfig({ compiler: ['swc-loader', swcConfig] }),
};
Environment variables
NODE_ENV
= 'prod' || 'production' || 'dev' || 'development'
When set to 'prod'
or 'production'
, source maps are omitted.
You cam also use the environment variables outlined in @repodog/babel-config
or @repodog/swc-config
to control what is output.