■ ■ ■ ■ ■ ■
packages/web/webpack/client.ts
| skipped 3 lines |
4 | 4 | | import CopyPlugin from 'copy-webpack-plugin'; |
5 | 5 | | import { configCommon, pluginsCommon, srcDir } from './common'; |
6 | 6 | | import { Configuration } from 'webpack'; |
| 7 | + | import { WebpackConfigOptions } from './config'; |
7 | 8 | | |
8 | 9 | | const distDir = 'dist/static'; |
9 | 10 | | |
10 | | - | export const clientConfig: (mode: 'development' | 'production', watch: boolean) => Configuration = ( |
| 11 | + | export const clientConfig: (options: WebpackConfigOptions) => Configuration = ({ |
11 | 12 | | mode, |
12 | | - | watch |
13 | | - | ) => ({ |
| 13 | + | publicPath, |
| 14 | + | watch = false, |
| 15 | + | plugins = [], |
| 16 | + | }) => ({ |
14 | 17 | | entry: join(__dirname, '..', srcDir, 'index.tsx'), |
15 | 18 | | ...configCommon(mode), |
16 | 19 | | module: { |
| skipped 59 lines |
76 | 79 | | new CopyPlugin({ |
77 | 80 | | patterns: [{ from: 'src/assets/sharing-image.png', to: 'sharing-image.png' }], |
78 | 81 | | }), |
| 82 | + | ...plugins, |
79 | 83 | | ], |
80 | 84 | | output: { |
81 | 85 | | filename: 'bundle.[fullhash].js', |
82 | 86 | | path: resolve(__dirname, '..', distDir), |
83 | | - | publicPath: '/static/', |
| 87 | + | publicPath, |
84 | 88 | | assetModuleFilename: '[hash][ext]', |
85 | 89 | | }, |
86 | 90 | | watch, |
| skipped 2 lines |