🎒 A no-frill webpack cli that requires next to nothing to get started.
- React 18
- TypeScript 5
- Styled Components
- Sass
$ npm install @neogeek/custom-webpack-cli --save-dev
package.json
{
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"styled-components": "^6.1.1"
},
"devDependencies": {
"@neogeek/custom-webpack-cli": "^3.0.0"
},
"scripts": {
"start": "custom-webpack-dev-server-cli",
"build": "custom-webpack-cli"
},
"private": true
}
src/index.jsx
const HelloMessage = ({ name }) => <div>Hello {name}</div>;
import { createRoot } from 'react-dom/client';
const root = createRoot(document.querySelector('body'));
root.render(<HelloMessage name="Taylor" />);
All static files (images, audio, video files) should be placed in a folder names public/
at the root of the project.
To customize the webpack config, add a webpack.custom.js
to the root of your project. The contents of that file will be merged with the webpack.config.js file distributed with this tool.
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
exclude: /node_modules\/(?!custom-component-library)/u,
include: /.*/
},
{
test: /\.tsx?$/u,
exclude: /node_modules\/(?!custom-component-library)/u,
include: /.*/
},
{
test: /\.jsx?$/u,
exclude: /node_modules\/(?!custom-component-library)/u,
include: /.*/
}
]
}
};
module.exports = {
devServer: {
open: true,
openPage: 'blog/'
}
};
const { resolve } = require('path');
module.exports = {
externals: {
react: 'react',
reactDOM: 'react-dom'
},
output: {
filename: 'bundle.min.js',
path: resolve(process.cwd(), 'dist'),
publicPath: '/',
library: {
type: 'commonjs2'
}
}
};