dojo / cli-build-webpack

🚀 **DEPRECATED** Dojo 2 - cli command for building applications
http://dojo.io
Other
4 stars 19 forks source link

`dojo build --watch` compiles code multiple times #137

Closed edhager closed 7 years ago

edhager commented 7 years ago

I am following the tutorials and when I create an app and run dojo build --watch, the code is compiled multiple times. It seems to vary between 3 and 6 times:

Dagobah-Hashtag-YodaYo:tutorial edhager$ dojo create --name biz-e-corp
Creating your new app: biz-e-corp

Creating Directories
 create biz-e-corp
 create biz-e-corp/src
 create biz-e-corp/src/styles
 create biz-e-corp/src/widgets
 create biz-e-corp/src/widgets/styles
 create biz-e-corp/tests
 create biz-e-corp/tests/unit
 create biz-e-corp/tests/unit/widgets
 create biz-e-corp/tests/functional

Creating Files
 create package.json
 create tsconfig.json
 create .gitignore
 create README.md
 create src/index.html
 create src/main.ts
 create src/main.css
 create src/App.ts
 create src/widgets/HelloWorld.ts
 create src/widgets/styles/HelloWorld.m.css
 create src/widgets/styles/HelloWorld.m.css.d.ts
 create tests/unit/all.ts
 create tests/unit/main.ts
 create tests/unit/App.ts
 create tests/unit/widgets/all.ts
 create tests/unit/widgets/HelloWorld.ts
 create tests/functional/all.ts
 create tests/functional/main.ts

Running npm install
⠋ npm install(node:5513) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: ENOENT: no such file or directory, open '/usr/local/lib/node_modules/@dojo/cli-create-app/templates/.gitignore'
(node:5513) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
 completed npm install

All done!

Dagobah-Hashtag-YodaYo:tutorial edhager$ cd biz-e-corp/
Dagobah-Hashtag-YodaYo:biz-e-corp edhager$ dojo build --watch
Starting server on http://localhost:9999
ts-loader: Using typescript@2.3.2 and /Volumes/Development/dojo2-sandbox/tutorial/biz-e-corp/tsconfig.json
Hash: 970b3a062ec6e8a55747
Version: webpack 2.5.1
Time: 9374ms
                          Asset       Size  Chunks                    Chunk Names
                    src/main.js    1.55 MB       0  [emitted]  [big]  src/main
                       main.css    1.96 kB       0  [emitted]         src/main
                     index.html  234 bytes          [emitted]         
widgets/styles/HelloWorld.m.css  312 bytes          [emitted]         
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.04 kB       0  
webpack: Compiled successfully.
webpack: Compiling...
Hash: 3f14b6b7de28f7936ec9
Version: webpack 2.5.1
Time: 795ms
      Asset     Size  Chunks                    Chunk Names
src/main.js  1.55 MB       0  [emitted]  [big]  src/main
   main.css  1.96 kB       0  [emitted]         src/main
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.04 kB       0  
webpack: Compiled successfully.
webpack: Compiling...
Hash: 3f14b6b7de28f7936ec9
Version: webpack 2.5.1
Time: 662ms
      Asset     Size  Chunks                    Chunk Names
src/main.js  1.55 MB       0  [emitted]  [big]  src/main
   main.css  1.96 kB       0  [emitted]         src/main
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.04 kB       0  
webpack: Compiled successfully.
webpack: Compiling...
Hash: 3f14b6b7de28f7936ec9
Version: webpack 2.5.1
Time: 928ms
      Asset     Size  Chunks                    Chunk Names
src/main.js  1.55 MB       0  [emitted]  [big]  src/main
   main.css  1.96 kB       0  [emitted]         src/main
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.04 kB       0  
webpack: Compiled successfully.
webpack: Compiling...
Hash: 3f14b6b7de28f7936ec9
Version: webpack 2.5.1
Time: 584ms
      Asset     Size  Chunks                    Chunk Names
src/main.js  1.55 MB       0  [emitted]  [big]  src/main
   main.css  1.96 kB       0  [emitted]         src/main
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.04 kB       0  
webpack: Compiled successfully.

I modified my main.ts and the watcher compiled the code only once. I hit ctrl-C and ran dojo build --watch again. The builder compiled the code 5 more times.

^C
Dagobah-Hashtag-YodaYo:biz-e-corp edhager$ dojo build --watch
Starting server on http://localhost:9999
ts-loader: Using typescript@2.3.2 and /Volumes/Development/dojo2-sandbox/tutorial/biz-e-corp/tsconfig.json
Hash: 970b3a062ec6e8a55747
Version: webpack 2.5.1
Time: 8998ms
                          Asset       Size  Chunks                    Chunk Names
                    src/main.js    1.55 MB       0  [emitted]  [big]  src/main
                       main.css    1.96 kB       0  [emitted]         src/main
                     index.html  234 bytes          [emitted]         
widgets/styles/HelloWorld.m.css  312 bytes          [emitted]         
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.04 kB       0  
webpack: Compiled successfully.
webpack: Compiling...
Hash: 3f14b6b7de28f7936ec9
Version: webpack 2.5.1
Time: 815ms
      Asset     Size  Chunks                    Chunk Names
src/main.js  1.55 MB       0  [emitted]  [big]  src/main
   main.css  1.96 kB       0  [emitted]         src/main
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.04 kB       0  
webpack: Compiled successfully.
webpack: Compiling...
Hash: 3f14b6b7de28f7936ec9
Version: webpack 2.5.1
Time: 714ms
      Asset     Size  Chunks                    Chunk Names
src/main.js  1.55 MB       0  [emitted]  [big]  src/main
   main.css  1.96 kB       0  [emitted]         src/main
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.04 kB       0  
webpack: Compiled successfully.
webpack: Compiling...
Hash: 3f14b6b7de28f7936ec9
Version: webpack 2.5.1
Time: 919ms
      Asset     Size  Chunks                    Chunk Names
src/main.js  1.55 MB       0  [emitted]  [big]  src/main
   main.css  1.96 kB       0  [emitted]         src/main
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.04 kB       0  
webpack: Compiled successfully.
webpack: Compiling...
Hash: 3f14b6b7de28f7936ec9
Version: webpack 2.5.1
Time: 555ms
      Asset     Size  Chunks                    Chunk Names
src/main.js  1.55 MB       0  [emitted]  [big]  src/main
   main.css  1.96 kB       0  [emitted]         src/main
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.04 kB       0  
webpack: Compiled successfully.

I hit ctrl-C again, ran the build command and the code was compiled 6 more times.

mwistrand commented 7 years ago

The css-module-dts-loader results in multiple compilations; I am working on a fix.