question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Got error output when using with Webpack

See original GitHub issue

When using Webpack to package the Ng2 projects with TypeScript, got such error outputs in console.

ERROR in ./~/typedjson/js/tests/polymorphism-abstract-class.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../typed-json in E:\Developments\Projects\fenxiao\node_modules\typedjson\js\tests
 @ ./~/typedjson/js/tests/polymorphism-abstract-class.js 20:8-84

ERROR in ./~/typedjson/js/tests/polymorphism-custom-names.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../typed-json in E:\Developments\Projects\fenxiao\node_modules\typedjson\js\tests
 @ ./~/typedjson/js/tests/polymorphism-custom-names.js 20:8-84

ERROR in ./~/typedjson/js/tests/polymorphism-interface.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../typed-json in E:\Developments\Projects\fenxiao\node_modules\typedjson\js\tests
 @ ./~/typedjson/js/tests/polymorphism-interface.js 15:8-84

ERROR in ./~/typedjson/js/tests/polymorphism-nested-arrays.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../typed-json in E:\Developments\Projects\fenxiao\node_modules\typedjson\js\tests
 @ ./~/typedjson/js/tests/polymorphism-nested-arrays.js 20:8-84

ERROR in ./~/typedjson/js/tests/polymorphism.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../typed-json in E:\Developments\Projects\fenxiao\node_modules\typedjson\js\tests
 @ ./~/typedjson/js/tests/polymorphism.js 20:8-84

ERROR in ./~/typedjson/js/tests/single-class.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../typed-json in E:\Developments\Projects\fenxiao\node_modules\typedjson\js\tests
 @ ./~/typedjson/js/tests/single-class.js 15:8-64

Do I need to set an exclude config or something I missed? Thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
francistmcommented, Jun 21, 2016

I updated webpack.config.js. (need ignore-loader npm module)

module.exports = {
  ...
  module: {
    { test: /tests/, loaders: ['ignore'] },
    { test: /\.ts$/, loaders: ['ts-loader'], exclude: /tests/ }
  }
}

It only got two warnings now. 😆

WARNING in ./~/typedjson/js/index.js
Critical dependencies:
25:24-31 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/typedjson/js/index.js 25:24-31

WARNING in ./~/typedjson/js/index.d.ts
Module build failed: Error: Typescript emitted no output for E:\Developments\Projects\fenxiao\node_modules\typedjson\js\index.d.ts
    at Object.loader (E:\Developments\Projects\fenxiao\node_modules\ts-loader\index.js:456:15)
 @ ./~/typedjson/js ^\.\/.*$

UPDATED

Looks the WebStorm Autocomplete function caused this issue. Need to import like import { xxx } from "typedjson/src/typed-json", And DO NOT use autocomplete like import { xxx } from "typedjson/js/index".

Finally solved, and thanks for such a useful module.

1reaction
francistmcommented, Jun 21, 2016

It only output 2 warning messages.

WARNING in ./~/typedjson/js/index.js
Critical dependencies:
25:24-31 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/typedjson/js/index.js 25:24-31

WARNING in ./~/typedjson/js/index.d.ts
Module build failed: Error: Typescript emitted no output for E:\Developments\Projects\fenxiao\node_modules\typedjson\js\index.d.ts
    at Object.loader (E:\Developments\Projects\fenxiao\node_modules\ts-loader\index.js:456:15)
 @ ./~/typedjson/js ^\.\/.*$

The interesting thing is even it output some error, but still published a well-worked file 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
Read more >
Webpack - No Output File, No Errors Reported · Issue #1736
I am learning Webpack and going through it again and again. In the latest build, there is something very strange going on.
Read more >
How do I get full error messages out of webpack?
I am trying to use webpack to autoprefix / compile my scss. Here is my webpack.config.js (basically copy / paste of bootstrap's):
Read more >
Output - webpack
webpack will not write output file when file already exists on disk with the same content.
Read more >
Stats - webpack
'errors-warnings', none, Only output errors and warnings happen. 'minimal', none, Only output when errors or new compilation happen.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found