-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
Describe the bug
Is it possible to import $app from components inside node_modules?
Seems to work in most cases but just found an error trying to import
<script>
import { afterNavigate } from '$app/navigation'
</script>Not sure if this is really a bug or expected behavior?
Reproduction
npm init svelte@next test-after-nav-import # no to all questions
cd test-after-nav-import
npm i
mkdir node_modules/pkg
echo '{ "name": "pkg", "exports": { "./file.svelte": "./file.svelte" } }' >> node_modules/pkg/package.json
echo '<script> import { afterNavigate } from "$app/navigation"; </script>' >> node_modules/pkg/file.svelte
echo '<script> import File from "pkg/file.svelte"; </script> <File />' >> src/routes/index.svelte
npm run build
npm run previewOpen the site and I get
Uncaught TypeError: Cannot read properties of undefined (reading 'disable_scroll_handling') at vendor-15d5f540.js:1:7117
System Info
System:
OS: macOS 12.2.1
CPU: (10) arm64 Apple M1 Pro
Memory: 340.23 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.6.0 - /opt/homebrew/bin/node
Yarn: 1.22.17 - /opt/homebrew/bin/yarn
npm: 8.5.1 - /opt/homebrew/bin/npm
Browsers:
Brave Browser: 99.1.36.117
Safari: 15.3Severity
serious, but I can work around it
Metadata
Metadata
Assignees
Labels
No labels