feat: core-hmr handling & watch ignore

This commit is contained in:
Igor Randjelovic
2021-03-11 23:05:47 +01:00
parent 0e8336f1d9
commit 6cc0ce3d57
12 changed files with 238 additions and 2 deletions

View File

@ -1,7 +1,6 @@
import { DefinePlugin, HotModuleReplacementPlugin } from 'webpack';
import Config from 'webpack-chain';
import { resolve } from 'path';
import os from 'os';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import FilterWarningsPlugin from 'webpack-filter-warnings-plugin';
@ -9,10 +8,10 @@ import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import TerserPlugin from 'terser-webpack-plugin';
// import { WatchStateLoggerPlugin } from '../plugins/WatchStateLoggerPlugin';
import { getProjectFilePath, getProjectRootPath } from '../helpers/project';
import { PlatformSuffixPlugin } from '../plugins/PlatformSuffixPlugin';
import { addCopyRule, applyCopyRules } from '../helpers/copyRules';
import { WatchStatePlugin } from '../plugins/WatchStatePlugin';
import { getProjectRootPath } from '../helpers/project';
import { hasDependency } from '../helpers/dependencies';
import { applyDotEnvPlugin } from '../helpers/dotEnv';
import { env as _env, IWebpackEnv } from '../index';
@ -80,6 +79,13 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
.globalObject('global')
.set('clean', true);
config.watchOptions({
ignored: [
`${getProjectFilePath('platforms')}/platforms/**`,
`${env.appResourcesPath ?? getProjectFilePath('App_Resources')}/**`
]
})
// Set up Terser options
config.optimization.minimizer('TerserPlugin').use(TerserPlugin, [
{