We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moving here from sveltejs/kit#1653
Describe the bug When JavaScript is in a string, HMR code is inserted into it.
<code> {` const product = 1 * 1; export default product; `.trim()} </code>
is displayed in the browser as
const product = 1 * 1; import * as ___SVELTE_HMR_HOT_API from '/sveltekit-javascript-repro/node_modules/svelte-hmr/runtime/hot-api-esm.js';import { adapter as ___SVELTE_HMR_HOT_API_PROXY_ADAPTER } from '/sveltekit-javascript-repro/node_modules/svelte-hmr/runtime/proxy-adapter-dom.js';if (import.meta && import.meta.hot) { if (false) import.meta.hot.accept(); product = ___SVELTE_HMR_HOT_API.applyHmr({ m: import.meta, id: "/sveltekit-javascript-repro/src/routes/index.svelte", hotOptions: {"preserveLocalState":false,"noPreserveStateKey":["@hmr:reset","@!hmr"],"preserveAllLocalStateKey":"@hmr:keep-all","preserveLocalStateKey":"@hmr:keep","noReload":false,"optimistic":true,"acceptNamedExports":true,"acceptAccessors":true,"injectCss":false,"cssEjectDelay":100,"native":false,"importAdapterName":"___SVELTE_HMR_HOT_API_PROXY_ADAPTER","noOverlay":true}, Component: product, ProxyAdapter: ___SVELTE_HMR_HOT_API_PROXY_ADAPTER, acceptable: true, preserveLocalState: false, emitCss: true, }); } export default product;
Repro https://github.com/kwangure/sveltekit-javascript-repro
Expected behavior HMR code should not be injected into strings.
System: OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa) CPU: (4) x64 Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz Memory: 1.56 GB / 3.05 GB Container: Yes Shell: 5.0.17 - /bin/bash Binaries: Node: 16.2.0 - /usr/bin/node npm: 7.13.0 - /usr/bin/npm npmPackages: @sveltejs/adapter-static: ^1.0.0-next.13 => 1.0.0-next.13 @sveltejs/kit: ^1.0.0-next.113 => 1.0.0-next.113 svelte: ^3.38.2 => 3.38.2
Severity It's not severe, but it it annoying. It's possible to work around it by escaping/HTML-encoding the JS text.
The text was updated successfully, but these errors were encountered:
Good catch. I'll fix the regex doing that.
Sorry, something went wrong.
0981070
@kafwangure This should be fixed with latest [email protected]. Can you confirm?
[email protected]
Well... Let's say it is fixed. Feel free to reopen if not.
No branches or pull requests
Moving here from sveltejs/kit#1653
Describe the bug
When JavaScript is in a string, HMR code is inserted into it.
is displayed in the browser as
Repro
https://github.com/kwangure/sveltekit-javascript-repro
Expected behavior
HMR code should not be injected into strings.
SvelteKit installation information
System:
OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa)
CPU: (4) x64 Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
Memory: 1.56 GB / 3.05 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 16.2.0 - /usr/bin/node
npm: 7.13.0 - /usr/bin/npm
npmPackages:
@sveltejs/adapter-static: ^1.0.0-next.13 => 1.0.0-next.13
@sveltejs/kit: ^1.0.0-next.113 => 1.0.0-next.113
svelte: ^3.38.2 => 3.38.2
Severity
It's not severe, but it it annoying. It's possible to work around it by escaping/HTML-encoding the JS text.
The text was updated successfully, but these errors were encountered: