简体   繁体   中英

webpack-dev-server cannot really compile main.js

Here is my project

webpack-dev-server terminal output:

Built at: 05/22/2020 6:43:46 PM
                                      Asset       Size  Chunks                               Chunk Names
       8d6d49ad1bd332417f87.hot-update.json   46 bytes          [emitted] [immutable] [hmr]  
    main.8d6d49ad1bd332417f87.hot-update.js  334 bytes    main  [emitted] [immutable] [hmr]  main
main.8d6d49ad1bd332417f87.hot-update.js.map  259 bytes    main  [emitted] [dev]              main
                                    main.js    383 KiB    main  [emitted]                    main
                                main.js.map    434 KiB    main  [emitted] [dev]              main
Entrypoint main = main.js main.8d6d49ad1bd332417f87.hot-update.js main.js.map main.8d6d49ad1bd332417f87.hot-update.js.map
[./src/t.js] 70 bytes {main} [built]
    + 39 hidden modules
ℹ 「wdm」: Compiled successfully.

I cannot find the main.js

roroco@roroco ~/Downloads/js/test-webpack $ du -ah|grep main.js
4.0K    ./node_modules/os-browserify/main.js
4.0K    ./node_modules/webpack-dev-server/lib/utils/createDomain.js
4.0K    ./node_modules/timers-browserify/main.js
12K ./node_modules/sockjs-client/lib/main.js

I find the reason: webpack-dev-server auto refresh code in memory, it doesn't compile code to latest

I don't know why webpack-dev-server doesn't auto compile in my case

but when i change dev-server port:

 devServer: {
    port: 3000,
    // contentBase: './',
    // watchOptions: {
    //   poll: true
    // }
  },

it fix

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM