Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mytecor/webpack-shared
Shared webpack config
https://github.com/mytecor/webpack-shared
Last synced: 22 days ago
JSON representation
Shared webpack config
- Host: GitHub
- URL: https://github.com/mytecor/webpack-shared
- Owner: mytecor
- License: mit
- Created: 2022-02-10T20:23:50.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-28T13:37:25.000Z (over 2 years ago)
- Last Synced: 2024-10-29T01:15:29.744Z (2 months ago)
- Language: TypeScript
- Size: 532 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webpack-shared
Shared webpack config
## Install
```bash
pnpm add -D webpack-shared
```## Usage
[ESModules only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
```js
import { join } from 'path'
import HtmlWebpackPlugin from 'html-webpack-plugin'import {
shared,
base,
css,
react,
typescript,
devServer,
plugin
} from 'webpack-shared'// Custom part
function entry() {
return { entry: './example/index.tsx' }
}// Custom plugin
const html = plugin(({ template, root }) => {
return {
plugins: [
new HtmlWebpackPlugin({
template: join(root, template),
inject: 'body'
})
]
}
})// Config
export default shared(import.meta.url, [
base(),
css(),
devServer(),
react(),
typescript(),entry,
html({ template: 'index.html' })
])
```The config parts will be merged by `mergeAndConcat` from [merge-anything](https://github.com/mesqueeb/merge-anything) library.
See the [example](https://github.com/mytecor/webpack-shared/blob/main/example) app.