dojo / cli

:rocket: Dojo - command line tooling.
http://dojo.io
Other
26 stars 34 forks source link

Error on build after `dojo create` #157

Closed gavinr closed 7 years ago

gavinr commented 7 years ago

Bug

I think this is a bug, but maybe just something about my environment. When I create a new dojo2 app using dojo create --name XYZ and then try to build (dojo build) I get an error:

ERROR in ./src/widgets/HelloWorld.ts
Module build failed: TypeError: Cannot create property 'version' on boolean 'false'
    at updateFileInCache (C:\...\temp\node_modules\ts-loader\dist\index.js:101:21)
    at successLoader (C:\...\temp\node_modules\ts-loader\dist\index.js:31:23)
    at Object.loader (C:\...\temp\node_modules\ts-loader\dist\index.js:21:12)
 @ ./src/App.ts 15:19-50
 @ ./src/main.ts
 @ multi ./src/main.css ./src/main.ts

Full Workflow

λ dojo version

The currently installed groups are:

build (@dojo/cli-build-webpack) 2.0.0-beta1.4
create (@dojo/cli-create-app) 2.0.0-beta2.2
test (@dojo/cli-test-intern) 2.0.0-beta1.6

You are currently running @dojo/cli 2.0.0-beta2.2
λ dojo create --name temp
Creating your new app: temp

Creating Directories
 create temp
 create temp/src
 create temp/src/styles
 create temp/src/widgets
 create temp/src/widgets/styles
 create temp/tests
 create temp/tests/unit
 create temp/tests/unit/widgets
 create temp/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:12596) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: ENOENT: no such file or directory, open 'C:\Users\USER\AppData\Roaming\npm\node_modules\@dojo\cli\node_modules\@dojo\cli-create-app\templates\.gitignore'
 completed npm install

All done!
λ cd temp\
λ dojo build
ts-loader: Using typescript@2.3.4 and C:\Users\USER\Documents\Projects\temp\temp\tsconfig.json
Hash: e4f2396b1a7b281a3aeb
Version: webpack 2.7.0
Time: 5601ms
                          Asset       Size  Chunks             Chunk Names
                    src/main.js    86.3 kB       0  [emitted]  src/main
                       main.css  277 bytes       0  [emitted]  src/main
                src/main.js.map     654 kB       0  [emitted]  src/main
                   main.css.map  237 bytes       0  [emitted]  src/main
                     index.html  222 bytes          [emitted]
widgets/styles/HelloWorld.m.css  312 bytes          [emitted]

ERROR in ./src/widgets/HelloWorld.ts
Module build failed: TypeError: Cannot create property 'version' on boolean 'false'
    at updateFileInCache (C:\Users\USER\Documents\Projects\temp\temp\node_modules\ts-loader\dist\index.js:101:21)
    at successLoader (C:\Users\USER\Documents\Projects\temp\temp\node_modules\ts-loader\dist\index.js:31:23)
    at Object.loader (C:\Users\USER\Documents\Projects\temp\temp\node_modules\ts-loader\dist\index.js:21:12)
 @ ./src/App.ts 15:19-50
 @ ./src/main.ts
 @ multi ./src/main.css ./src/main.ts
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.03 kB       0
Webpack Bundle Analyzer saved report to C:\Users\USER\Documents\Projects\temp\temp\dist\report.html

Expected behavior:

There should be no error an the example app should be built.

Actual behavior:

Error shown in terminal.

agubler commented 7 years ago

@gavinr Thanks for raising the issue, this is due to a release of ts-loader and the fact that the version of cli-build-webpack currently used in the template for create-app isn't pinned to a working ts-loader version.

To work around the issue you can install the previous version of ts-loader using npm i ts-loader@2.3.1 until we have released a new version of create-app (that we are working on doing now).

agubler commented 7 years ago

The PR with the changes to pin the build dependencies is here: https://github.com/dojo/cli-build-webpack/pull/182

agubler commented 7 years ago

We have just released a patch for latest and beta1 version tags, so hopefully this should now work if you re-install the dojo/cli and try create another app.

gavinr commented 7 years ago

Running the following worked. Thanks for the quick response @agubler!

npm uninstall -g @dojo/cli
npm install -g @dojo/cli