GithubHelp home page GithubHelp logo

fork-ts-checker-webpack-plugin-bug-repro-561's Introduction

fork-ts-checker-webpack-plugin (Issue #561)

Issue

fork-ts-checker-webpack-plugin is not referencing module declarations as specified in tsconfig.json > compilerOptions.typeRoots.

Reproduction steps:

  1. npm install
  2. npm run build:tsc
  3. Observe no build error
  4. npm run build:webpack
  5. Observe build error:
Hash: 18f26cef5e5db950fb3c
Version: webpack 4.41.2
Time: 1962ms
Built at: 03/11/2021 9:49:16 AM
 2 assets
Entrypoint index = index.js
[1] ./src/ts/Acme.png 61 bytes {0} [built]
[2] ./src/ts/index.tsx 189 bytes {0} [built]
    + 3 hidden modules

ERROR in src/ts/index.tsx:3:22
TS2307: Cannot find module './Acme.png' or its corresponding type declarations.
    1 | import React from 'react';
    2 |
  > 3 | import AcmeLogo from './Acme.png';
      |                      ^^^^^^^^^^^^
    4 |
    5 | const IndexComponent: React.FC = () => {
    6 |   return <img src={AcmeLogo}/>;
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `webpack --color --env production`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Workaround

  1. Update webpack.config.js to add the following to the configOverwrite.include array passed to the ForkTsCheckerWebpackPlugin plugin in webpack.config.js:
'./src/types/**/*.ts'
  1. Re-run npm run build:webpack
  2. Observe no build error

fork-ts-checker-webpack-plugin-bug-repro-561's People

Contributors

masterkale avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.