mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
fix(webpack): map 'svelte' to 'svelte/internal' to avoid forced ssr (#9627)
This commit is contained in:
@ -1,4 +1,3 @@
|
|||||||
import { merge } from 'webpack-merge';
|
|
||||||
import Config from 'webpack-chain';
|
import Config from 'webpack-chain';
|
||||||
|
|
||||||
import { getProjectFilePath } from '../helpers/project';
|
import { getProjectFilePath } from '../helpers/project';
|
||||||
@ -19,6 +18,10 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
|||||||
// electron-main sneaks us past the target == 'node' check and gets us HMR
|
// electron-main sneaks us past the target == 'node' check and gets us HMR
|
||||||
config.target('electron-main');
|
config.target('electron-main');
|
||||||
|
|
||||||
|
// turns out this isn't enough now. svelte uses "node" of which "electron-main" is a subset in its export map forcing imports
|
||||||
|
// for 'svelte' to 'ssr.mjs'. We define an alias here to force it back.
|
||||||
|
config.resolve.alias.set('svelte$', 'svelte/internal');
|
||||||
|
|
||||||
// svelte-hmr still references tns-core-modules, so we shim it here for compat.
|
// svelte-hmr still references tns-core-modules, so we shim it here for compat.
|
||||||
config.resolve.alias.set('tns-core-modules', '@nativescript/core');
|
config.resolve.alias.set('tns-core-modules', '@nativescript/core');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user