Typescript example runs with errors
See original GitHub issueVersion
Reproduction link
https://github.com/nuxt/nuxt.js/tree/dev/examples/typescript
Steps to reproduce
Run the app (npm run dev)
What is expected ?
“Hello from client !” should be posted in the dev console, and the app should run without issues. (I had to change the file to .js because server
is not defined on the process
object.
What is actually happening?
One error and 2 warnings are displayed in the console (although the site displays correctly).
ReferenceError: [nuxt] Error while mounting app: exports is not defined at Module../node_modules/babel-loader/lib/index.js?!./node_modules/ts-loader/index.js?!./node_modules/vue-loader/lib/index.js?!./pages/index.vue?vue&type=script&lang=ts& (index.js:220)
vendors.app.js:2630 ./components/HelloWorld.vue?vue&type=script&lang=ts& 1:235-238"export 'default' (imported as 'mod') was not found in '-!../node_modules/babel-loader/lib/index.js??ref--3-0!../node_modules/ts-loader/index.js??ref--3-1!../node_modules/vue-loader/lib/index.js??vue-loader-options!./HelloWorld.vue?vue&type=script&lang=ts&'./pages/index.vue?vue&type=script&lang=ts& 1:230-233"export 'default' (imported as 'mod') was not found in '-!../node_modules/babel-loader/lib/index.js??ref--3-0!../node_modules/ts-loader/index.js??ref--3-1!../node_modules/vue-loader/lib/index.js??vue-loader-options!./index.vue?vue&type=script&lang=ts&'```
<!--cmty--><!--cmty_prevent_hook-->
<div align="right"><sub><em>This bug report is available on <a href="https://cmty.app/nuxt">Nuxt</a> community (<a href="https://cmty.app/nuxt/nuxt.js/issues/c8873">#c8873</a>)</em></sub></div>
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them.
Read more >Detecting Errors Before Running Code With TypeScript
In examples of this post series, I will use mostly code that written in Node environment. It won't be any specific code that...
Read more >the Example code of TS can't run but return an Error
"Typescript: Cannot use import statement outside a module",this is not solve my question.but I can use codepen or codesandbox to test react code ......
Read more >Understanding TypeScript Errors for Beginners
Another common mistake amongst TypeScript beginners is to assume that because there are no compile-time errors there will be no run-time errors.
Read more >Detect JavaScript errors during compile time using TypeScript ...
During compile-time TypeScript can emit errors to a terminal, ... For example, if we try to run this simple code in Node.js
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
@MrJmpl3 will be fixed in 2.6, Nuxt won’t override your
tsconfig.json
anymore.Version: 2.5.1 , Nuxtjs add
"strict": true
in my custom tsconfig.json innpm run dev