Nested import error: TypeError: "header.$$ is undefined".
See original GitHub issue🐛 Bug Report
Nested import error: TypeError: "header.$$ is undefined"
.
Without import app works normally, with import I get this error.
🎛 Configuration
{
"name": "sveltetest",
"version": "1.0.0",
"description": "",
"main": "index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"browserslist": [
"last 1 chrome versions",
"last 1 firefox version"
],
"author": "Janealter",
"license": "ISC",
"devDependencies": {
"@babel/polyfill": "^7.4.4",
"parcel-bundler": "^1.12.3",
"parcel-plugin-svelte": "^3.0.1",
"svelte": "^3.4.4"
}
}
Commands:
./node_modules/parcel-bundler/bin/cli.js index.html --no-cache
;
./node_modules/parcel-bundler/bin/cli.js index.html
;
parcel index.html
;
parcel index.html --no-cache
💻 Code Sample
./index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Svelte Test</title>
</head>
<body>
<main></main>
<script src="src/index.js"></script>
</body>
</html>
./src/index.js
import '@babel/polyfill';
import App from './App';
const app = new App({
target: document.querySelector('main'),
data: {},
});
./src/App.svelte
<script>
import Header from './components/Header';
const name = 'Test';
</script>
<p>{name}</p>
<Header/>
./src/components/Header.svelte
<header>
<p>Test text</p>
</header>
🌍 Your Environment
Svelte 3.4.4, Parcel 1.12.3
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
React When i am trying to get into a nested object the fetch ...
when i try to get into the pokemon.types.type.name i get a error saying Uncaught TypeError: Cannot read properties of undefined (reading ...
Read more >Features | Vite
Vite caches dependency requests via HTTP headers, so if you wish to locally ... Use the Type-Only Imports and Export syntax to avoid...
Read more >SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered....
Read more >Python import: Advanced Techniques and Tips
The Python import system is as powerful as it is useful. In this in-depth tutorial, you'll learn how to harness this power to...
Read more >Troubleshooting | React Navigation
If the module points to an npm package (i.e. the name of the module doesn't with ./ ), then it's probably due to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
yes, it’s problem related with HMR. you can use simple workaround with disabling hot reloading:
parcel --no-hmr index.html
Just in case this helps, as it is not explicitly mentioned. I’m seeing:
TypeError: Cannot read property ‘fragment’ of undefined at Object.c (Hello.svelte:117)
With the most simplest nested component. The thing is that this only happens when running “parcel” or “parcel watch”, running “parcel build” generates a correct output.
parcel: 1.12.3 parcel-plugin-svelte: 3.0.1 svelte: 3.6.4