Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: prettier - Module not found: Error: Can't resolve '@microsoft/typescript-etw' #1483

Closed
SuperITMan opened this issue Jan 14, 2020 · 2 comments · Fixed by #1484
Closed

Comments

@SuperITMan
Copy link
Member

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/NationalBankBelgium/stark/blob/master/CONTRIBUTING.md#got-a-question-or-problem

Current behavior

With Prettier version ^1.19.0, there is an issue during the build:

WARNING in ./node_modules/prettier/parser-typescript.js
Module not found: Error: Can't resolve '@microsoft/typescript-etw' in '/home/superitman/dev/stark/showcase/node_modules/prettier'
resolve '@microsoft/typescript-etw' in '/home/superitman/dev/stark/showcase/node_modules/prettier'
  Parsed request is a module
  using description file: /home/superitman/dev/stark/showcase/node_modules/prettier/package.json (relative path: .)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      looking for modules in /home/superitman/dev/stark/showcase/src
        using description file: /home/superitman/dev/stark/showcase/package.json (relative path: ./src)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: /home/superitman/dev/stark/showcase/package.json (relative path: ./src/@microsoft/typescript-etw)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/showcase/src/@microsoft/typescript-etw doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/showcase/src/@microsoft/typescript-etw.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/showcase/src/@microsoft/typescript-etw.tsx doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/showcase/src/@microsoft/typescript-etw.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/showcase/src/@microsoft/typescript-etw.js doesn't exist
            as directory
              /home/superitman/dev/stark/showcase/src/@microsoft/typescript-etw doesn't exist
      /home/superitman/dev/stark/showcase/node_modules/prettier/node_modules doesn't exist or is not a directory
      /home/superitman/dev/stark/showcase/node_modules/node_modules doesn't exist or is not a directory
      /home/superitman/dev/node_modules doesn't exist or is not a directory
      /home/superitman/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      looking for modules in /home/superitman/dev/stark/showcase/node_modules
        using description file: /home/superitman/dev/stark/showcase/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
      looking for modules in /home/superitman/dev/stark/node_modules
        using description file: /home/superitman/dev/stark/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: /home/superitman/dev/stark/showcase/package.json (relative path: ./node_modules/@microsoft/typescript-etw)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
          using description file: /home/superitman/dev/stark/package.json (relative path: ./node_modules/@microsoft/typescript-etw)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/showcase/node_modules/@microsoft/typescript-etw doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/node_modules/@microsoft/typescript-etw doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/showcase/node_modules/@microsoft/typescript-etw.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/node_modules/@microsoft/typescript-etw.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/showcase/node_modules/@microsoft/typescript-etw.tsx doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/node_modules/@microsoft/typescript-etw.tsx doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/showcase/node_modules/@microsoft/typescript-etw.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/node_modules/@microsoft/typescript-etw.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/superitman/dev/stark/showcase/node_modules/@microsoft/typescript-etw.js doesn't exist
            as directory
              /home/superitman/dev/stark/showcase/node_modules/@microsoft/typescript-etw doesn't exist
              /home/superitman/dev/stark/node_modules/@microsoft/typescript-etw.js doesn't exist
            as directory
              /home/superitman/dev/stark/node_modules/@microsoft/typescript-etw doesn't exist
[/home/superitman/dev/stark/showcase/src/@microsoft/typescript-etw]
[/home/superitman/dev/stark/showcase/src/@microsoft/typescript-etw.ts]
[/home/superitman/dev/stark/showcase/src/@microsoft/typescript-etw.tsx]
[/home/superitman/dev/stark/showcase/src/@microsoft/typescript-etw.mjs]
[/home/superitman/dev/stark/showcase/src/@microsoft/typescript-etw.js]
[/home/superitman/dev/stark/showcase/node_modules/prettier/node_modules]
[/home/superitman/dev/stark/showcase/node_modules/node_modules]
[/home/superitman/dev/node_modules]
[/home/superitman/node_modules]
[/home/node_modules]
[/node_modules]
[/home/superitman/dev/stark/showcase/node_modules/@microsoft/typescript-etw]
[/home/superitman/dev/stark/node_modules/@microsoft/typescript-etw]
[/home/superitman/dev/stark/showcase/node_modules/@microsoft/typescript-etw.ts]
[/home/superitman/dev/stark/node_modules/@microsoft/typescript-etw.ts]
[/home/superitman/dev/stark/showcase/node_modules/@microsoft/typescript-etw.tsx]
[/home/superitman/dev/stark/node_modules/@microsoft/typescript-etw.tsx]
[/home/superitman/dev/stark/showcase/node_modules/@microsoft/typescript-etw.mjs]
[/home/superitman/dev/stark/node_modules/@microsoft/typescript-etw.mjs]
[/home/superitman/dev/stark/showcase/node_modules/@microsoft/typescript-etw.js]
[/home/superitman/dev/stark/node_modules/@microsoft/typescript-etw.js]
 @ ./node_modules/prettier/parser-typescript.js
 @ ./node_modules/@nationalbankbelgium/stark-ui/fesm5/stark-ui.js
 @ ./src/app/app.module.ngfactory.js
 @ ./src/main.browser.ts
 @ multi ./src/main.browser.ts

The issue has been solved in Prettier prettier/prettier#6903 but will be published with version 2.0. There is no announced date currently.

We can fix it temporary by adding

module: {
  // ...
  noParse: /prettier\/parser-typescript/,
  // ...

in webpack-partial.common.js in stark-build.

Expected behavior

No warnings during build.

Minimal reproduction of the problem with instructions

Clone stark, run "npm run showcase" and see the warning in console.

What is the motivation / use case for changing the behavior?

Fixing issue

Environment


Angular version: 7.x
Stark version: 10.0.0-rc.3
@SuperITMan SuperITMan added this to the 10.0.0-rc.4 milestone Jan 14, 2020
@SuperITMan SuperITMan self-assigned this Jan 14, 2020
SuperITMan referenced this issue in SuperITMan/stark Jan 14, 2020
SuperITMan referenced this issue in SuperITMan/stark Jan 14, 2020
SuperITMan referenced this issue in SuperITMan/stark Jan 14, 2020
SuperITMan referenced this issue in SuperITMan/stark Jan 15, 2020
…o prevent "Can't resolve '@microsoft/typescript-etw'" warning

ISSUES CLOSED: #1483
@SuperITMan SuperITMan removed their assignment Jan 15, 2020
@enzo-nbb
Copy link

enzo-nbb commented Mar 4, 2021

Hi, prettier is now in version 2+.
Also, even with this temporary fix being present in the stark-build config file, I still have this error when building the project.

@SuperITMan
Copy link
Member Author

Hi @enzo-nbb
Prettier will be upgraded to its last version next week. This not working temp fix will be removed at the same time.
This upgrade will be part of stark release v10.2.0 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants