mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: HMRRuntime injection (wip)
This commit is contained in:
@@ -81,7 +81,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
|
||||
config.watchOptions({
|
||||
ignored: [
|
||||
`${getProjectFilePath('platforms')}/platforms/**`,
|
||||
`${getProjectFilePath('platforms')}/**`,
|
||||
`${env.appResourcesPath ?? getProjectFilePath('App_Resources')}/**`
|
||||
]
|
||||
})
|
||||
@@ -137,6 +137,15 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
// resolve symlinks
|
||||
config.resolve.symlinks(true);
|
||||
|
||||
config.module.rule('bundle')
|
||||
.enforce('post')
|
||||
.test(entryPath)
|
||||
.use('nativescript-hot-loader')
|
||||
.loader('nativescript-hot-loader')
|
||||
.options({
|
||||
injectHMRRuntime: true
|
||||
})
|
||||
|
||||
// set up ts support
|
||||
config.module
|
||||
.rule('ts')
|
||||
|
||||
@@ -3,6 +3,7 @@ import { merge } from 'webpack-merge';
|
||||
import Config from 'webpack-chain';
|
||||
import fs from 'fs';
|
||||
|
||||
import { hasDependency } from "../helpers/dependencies";
|
||||
import { getPlatformName } from '../helpers/platform';
|
||||
import { env as _env, IWebpackEnv } from '../index';
|
||||
import { error } from "../helpers/log";
|
||||
@@ -46,18 +47,20 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
});
|
||||
});
|
||||
|
||||
config.plugin('ForkTsCheckerWebpackPlugin').tap((args) => {
|
||||
args[0] = merge(args[0], {
|
||||
typescript: {
|
||||
extensions: {
|
||||
vue: {
|
||||
enabled: true,
|
||||
compiler: 'nativescript-vue-template-compiler',
|
||||
config.when(hasDependency('typescript'), (config) => {
|
||||
config.plugin('ForkTsCheckerWebpackPlugin').tap((args) => {
|
||||
args[0] = merge(args[0], {
|
||||
typescript: {
|
||||
extensions: {
|
||||
vue: {
|
||||
enabled: true,
|
||||
compiler: 'nativescript-vue-template-compiler',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
return args;
|
||||
});
|
||||
return args;
|
||||
});
|
||||
|
||||
// add VueLoaderPlugin as the first plugin
|
||||
|
||||
Reference in New Issue
Block a user