Vue Cli Change Entry File (main.ts to main.js)

February 8, 2020

I 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? (webpack)/hot/dev-server.js ./src/main.ts, multi (webpack)-dev-server/client?http://localhost (webpack)/hot/dev-server.js (webpack)-dev-server/client? ./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'
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.