JS: `import` does not work
See original GitHub issueDescribe the bug
One would expect import
to work, as it is just default js by now.
It shows “Error: Cannot use import statement outside a module” … but the root of a JS env should be module compatible.
Please complete the following:
Which version of .NET Interactive are you using? (In a notebook, run the #!about
magic command. ):
1.0.317502+9c2a225c543085a04516cc4fc490919d5925ba87
- OS
- Windows 11
- Windows 10
- macOS
- Linux (Please specify distro)
- iOS
- Android
- Browser
- Chrome
- Edge
- Firefox
- Safari
- Frontend
- Jupyter Notebook
- Jupyter Lab
- nteract
- Visual Studio Code
- Visual Studio Code Insiders
- Visual Studio
- Other (please specify)
Screenshots
Issue Analytics
- State:
- Created a year ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
javascript - ES6 imports doesn't work
1. You need to include type="module" in your script tag. · the issue is likely that for ES6 modules to work in javascript,...
Read more >Why import in js not working?
js only sets a variable and exports, but doesn't do anything else. data.js has the console.log , so you should find out how...
Read more >Javascript Fix Cannot Use Import Statement Outside A ...
Learn how to fix cannot use import statement outside a module error and successfully import function from another file in JavaScript.
Read more >import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live bindings which are exported by another module. The imported bindings are ...
Read more >import() - JavaScript - MDN Web Docs - Mozilla
The import() call is a syntax that closely resembles a function call, but import itself is a keyword, not a function. You cannot...
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
There’s a slightly odd workaround that we found; it requires using an HTML cell for the
import
line (and assigning it to thewindow
object) and in a separate JS cell running the actual code.interesting use of import here