1 | import babel from '@berun/runner-babel'
|
2 | import polyfills from '@berun/runner-web-polyfills'
|
3 | import Berun from '@berun/berun'
|
4 | import webpack from './index'
|
5 |
|
6 | export default (berun: Berun, options: { title?: string } = {}) => {
|
7 | const ISPRODUCTION = process.env.NODE_ENV === 'production'
|
8 |
|
9 | berun
|
10 | .use(babel)
|
11 | .use(webpack)
|
12 | .use(polyfills)
|
13 | .when(ISPRODUCTION, b => b.use(webpack.terser))
|
14 | .use(webpack.ruleParser)
|
15 | .use(webpack.ruleMjs)
|
16 | .use(webpack.ruleMainImage)
|
17 | .use(webpack.ruleMainCompile)
|
18 |
|
19 | .use(webpack.ruleMainStatic)
|
20 | .use(webpack.ruleMainSvg)
|
21 | .use(webpack.pluginHtml, { title: options.title })
|
22 | .use(webpack.pluginInterpolateHtml)
|
23 | .use(webpack.pluginEnv)
|
24 | .use(webpack.pluginPackageInfo)
|
25 | .use(webpack.pluginProgressBar)
|
26 | .use(webpack.pluginModuleNotFound)
|
27 |
|
28 | .when(!ISPRODUCTION, b => b.use(webpack.pluginHot))
|
29 | .when(!ISPRODUCTION, b => b.use(webpack.pluginCaseSensitivePaths))
|
30 | .when(!ISPRODUCTION, b => b.use(webpack.pluginWatchMissingNodeModules))
|
31 | .use(webpack.pluginMoment)
|
32 | .use(webpack.pluginManifest)
|
33 | .when(berun.options.paths.isTypeScript, b =>
|
34 | b.use(webpack.pluginForkTsChecker)
|
35 | )
|
36 |
|
37 | berun.sparky.task('start', webpack.taskDev)
|
38 | berun.sparky.task('build', webpack.taskProd)
|
39 | berun.sparky.task('test', () => {
|
40 |
|
41 | })
|
42 | }
|