Vue Cli Change Entry File (main.ts to main.js)
February 8, 2020I setup a vue project via cli and selected TypeScript as the default language, thus main.ts
is created as the default entry point.
I wanted to switch main.ts
to main.js
to use JavaScript instead of TypeScript.
Running npm run serve
report the following error
INFO Starting development server...
Starting type checking service...
Using 1 worker with 2048MB memory limit
98% after emitting CopyPlugin
ERROR Failed to compile with 2 errors 3:51:27 PM
This relative module was not found:
* ./src/main.ts in multi (webpack)-dev-server/client?http://10.0.2.15:8081/sockjs-node (webpack)/hot/dev-server.js ./src/main.ts, multi (webpack)-dev-server/client?http://localhost (webpack)/hot/dev-server.js (webpack)-dev-server/client?http://10.0.2.15:8081/sockjs-node ./src/main.ts
Type checking in progress...
No type errors found
It seems like npm run serve
is still referring to main.ts
.
To solve this issue, edit /vue.config.js
(create the file at root project directory if it does not exist).
module.exports = {
pages: {
index: {
entry: 'src/main.js'
}
}
}
- algo-trading
- algolia
- analytics
- android
- android-ktx
- android-permission
- android-studio
- apps-script
- bash
- binance
- bootstrap
- bootstrapvue
- chartjs
- chrome
- cloud-functions
- coding-interview
- contentresolver
- coroutines
- crashlytics
- crypto
- css
- dagger2
- datastore
- datetime
- docker
- eslint
- firebase
- firebase-auth
- firebase-hosting
- firestore
- firestore-security-rules
- flask
- fontawesome
- fresco
- git
- github
- glide
- godot
- google-app-engine
- google-cloud-storage
- google-colab
- google-drive
- google-maps
- google-places
- google-play
- google-sheets
- gradle
- html
- hugo
- inkscape
- java
- java-time
- javascript
- jetpack-compose
- jetson-nano
- kotlin
- kotlin-serialization
- layout
- lets-encrypt
- lifecycle
- linux
- logging
- lubuntu
- markdown
- mate
- material-design
- matplotlib
- md5
- mongodb
- moshi
- mplfinance
- mysql
- navigation
- nginx
- nodejs
- npm
- nuxtjs
- nvm
- pandas
- payment
- pip
- pwa
- pyenv
- python
- recylerview
- regex
- room
- rxjava
- scoped-storage
- selenium
- social-media
- ssh
- ssl
- static-site-generator
- static-website-hosting
- sublime-text
- ubuntu
- unit-test
- uwsgi
- viewmodel
- viewpager2
- virtualbox
- vue-chartjs
- vue-cli
- vue-router
- vuejs
- vuelidate
- vuepress
- web-development
- web-hosting
- webpack
- windows
- workmanager
- wsl
- yarn