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

Error in production build when using webpack DLLPlugin, related to sideEffects setting #3111

Closed
mhgamework opened this issue Aug 28, 2018 · 2 comments
Labels

Comments

@mhgamework
Copy link

Bug Report

I recently upgraded to latest semantic-ui-react, and now webpack seems to not correctly bundle all semantic-ui-react chunks in production builds.

When i set sideEffects:false in vendor.js build, the problem goes away, so i think this is related to webpack treeshaking and the recent setting of "sideEffects" in semantic-ui-react

Steps

I made a reproduction project, see below. Basically the steps are

  • Build a vendor.js that uses the DllPlugin to put semantic-ui-react in a separate bundle
  • Build the main.js that uses the dllplugin to reference vendor.js
  • Browse to the react app

Expected Result

App should render

Actual Result

App throws on loading webpack imports:

vendor.js:21 Uncaught TypeError: Cannot read property 'call' of undefined
    at __webpack_require__ (vendor.js:21)
    at Module.hasOwn (vendor.js:352)
    at __webpack_require__ (vendor.js:21)
    at Module.<anonymous> (vendor.js:2940)
    at __webpack_require__ (vendor.js:21)
    at Module.<anonymous> (vendor.js:18245)
    at __webpack_require__ (vendor.js:21)
    at Module.<anonymous> (vendor.js:18208)
    at __webpack_require__ (vendor.js:21)
    at Module.module.exports (vendor.js:26903)

Version

0.82.2

Testcase

Uploaded as zip as it is a custom build. Sleek.WebSites.App.zip

  • npm install
  • npm run start => builds vendor.js, main.js, and serves
  • Go to http://localhost:5000
  • this fails with error

Workaround:

  • Stop serve
  • enable sideEffects:false in webpack.config.vendor.js
  • npm run start
  • Page now doesnt show error
@welcome
Copy link

welcome bot commented Aug 28, 2018

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@layershifter
Copy link
Member

@mhgamework Thanks for the report, but it's a Webpack issue. I'm not enough familar with its internals, so please move it there.


Similar issues:
webpack/webpack#7425
webpack/webpack#7499 (comment)


I've recently checked, without DllPlugin everything works fine.

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

No branches or pull requests

2 participants