create-react-app-typescript icon indicating copy to clipboard operation
create-react-app-typescript copied to clipboard

Module is missing in production mode (webpack)

Open AndyOGo opened this issue 7 years ago • 6 comments

Is this a bug report?

(write your answer here)

Yes.

Though is related to fixed webpack version of 3.8.1:

  • https://github.com/webpack/webpack/issues/7499
  • https://github.com/webpack/webpack/issues/7425

And we use react-app-rewired, with typescripts, which uses your package und your nailed webpack version.

Can you also reproduce the problem with npm 4.x?

I use npm 5...

Which terms did you search for in User Guide?

(Write your answer here if relevant.)

Environment

  1. npm ls react-scripts-ts (if you haven’t ejected):
  2. node -v:
  3. npm -v:
  4. yarn --version (if you use Yarn):
  5. npm ls react-scripts-ts (if you haven’t ejected):

Then, specify:

  1. Operating system:
  2. Browser and version (if relevant):

Steps to Reproduce

(Write your steps here:)

We have a reproduction repo:

  1. git clone https://github.com/martinoss/reproduce-scss-bug
  2. yarn build
  3. open localhost
  4. Will throw: TypeError: Cannot read property 'call' of undefined
    o (main.9cac5c4f.js:formatted:26)
    544 (persons-list.scss:1)
    o (main.9cac5c4f.js:formatted:26)
    543 (persons-list.scss?3174:4)
    o (main.9cac5c4f.js:formatted:26)
    542 (1.56e5fc78.chunk.js:1)
    o (main.9cac5c4f.js:formatted:26)
    Promise.then (async)
    loader (routes.ts:6)
    f (main.9cac5c4f.js:formatted:6499)
    v (main.9cac5c4f.js:formatted:6566)
    n (main.9cac5c4f.js:formatted:6591)
    Ii (main.9cac5c4f.js:formatted:11110)
    da (main.9cac5c4f.js:formatted:11833)
    ha (main.9cac5c4f.js:formatted:11854)
    Ga (main.9cac5c4f.js:formatted:12109)
    Ya (main.9cac5c4f.js:formatted:12068)
    Ha (main.9cac5c4f.js:formatted:12056)
    za (main.9cac5c4f.js:formatted:12011)
    ba (main.9cac5c4f.js:formatted:11941)
    enqueueSetState (main.9cac5c4f.js:formatted:10547)
    O.setState (main.9cac5c4f.js:formatted:7392)
    t (main.9cac5c4f.js:formatted:6630)
    (anonymous) (main.9cac5c4f.js:formatted:6638)
    Promise.then (async)
    n._loadModule (main.9cac5c4f.js:formatted:6637)
    n.componentWillMount (main.9cac5c4f.js:formatted:6608)
    li (main.9cac5c4f.js:formatted:10594)
    Ii (main.9cac5c4f.js:formatted:11117)
    da (main.9cac5c4f.js:formatted:11833)
    ha (main.9cac5c4f.js:formatted:11854)
    Ga (main.9cac5c4f.js:formatted:12109)
    Ya (main.9cac5c4f.js:formatted:12068)
    Ha (main.9cac5c4f.js:formatted:12056)
    za (main.9cac5c4f.js:formatted:12011)
    ba (main.9cac5c4f.js:formatted:11941)
    ou (main.9cac5c4f.js:formatted:12498)
    au (main.9cac5c4f.js:formatted:12508)
    hu.render (main.9cac5c4f.js:formatted:12705)
    (anonymous) (main.9cac5c4f.js:formatted:12599)
    eu (main.9cac5c4f.js:formatted:12435)
    vu (main.9cac5c4f.js:formatted:12598)
    render (main.9cac5c4f.js:formatted:12755)
    (anonymous) (main.9cac5c4f.js:formatted:7334)
    o (main.9cac5c4f.js:formatted:26)
    (anonymous) (main.9cac5c4f.js:formatted:6753)
    o (main.9cac5c4f.js:formatted:26)
    (anonymous) (main.9cac5c4f.js:formatted:100)
    (anonymous) (main.9cac5c4f.js:formatted:101)
    

Expected Behavior

(Write what you thought would happen.)

Webpack's automatic Code-Splitting should work, containing all needed modules.

Actual Behavior

(Write what happened. Please add screenshots!)

Webpacks automatic Code-Splitting does not work, because at least one module is missing. This is a known webpack bug, and higher versions should provide bugfixes.

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

https://github.com/martinoss/reproduce-scss-bug

AndyOGo avatar Sep 04 '18 15:09 AndyOGo

Hey!

Sorry but your stacktrace will be more helpful if you do it w/o code minification. :)

r3nya avatar Sep 28 '18 20:09 r3nya

@r3nya You are absolutely right. Though this error happens only in production mode 😞

I linked known webpack issues regarding missing modules for production builds.

AndyOGo avatar Oct 01 '18 08:10 AndyOGo

@AndyOGo oh man, got it.

I recommend to do ejecting configs, disable code minification manually and try to build again. ;)

r3nya avatar Oct 01 '18 08:10 r3nya

@r3nya Thanks for your quick reply.

I checked those issues regarding webpack and they should have been fixed in higher version. So I guess just upgrading webpack. should fix it.

AndyOGo avatar Oct 01 '18 08:10 AndyOGo

Wow, sounds good.

Btw, we will have webpack@4 soon (https://github.com/wmonk/create-react-app-typescript/pull/409). ;)

r3nya avatar Oct 01 '18 08:10 r3nya

great, then I'm looking forward for this PR :)

AndyOGo avatar Oct 01 '18 08:10 AndyOGo