everweij / react-laag

Hooks to build things like tooltips, dropdown menu's and popovers in React
https://www.react-laag.com
MIT License
906 stars 44 forks source link

Won't build Next.js project after update react-laag to v2.0.1 #54

Closed vikuscz closed 3 years ago

vikuscz commented 3 years ago

Problem I am not able to make production build of my Next.js project after update to react-laag@2.0.1. Development build (using nodemon) works fine. It won't work both on my local Debian in WSL 1 (node 15.2.1) and dockerized production server (some stable node 14 on alpine linux) but previously it worked fine with react-laag@1.8.0. Any idea what I do wrong? Thanks :-)

yarn run v1.22.5
$ rm -rf ./next && next build && tsc --project tsconfig.server.json
Loaded env from /mnt/c/sample-project/.env.local
Loaded env from /mnt/c/sample-project/.env.production
Loaded env from /mnt/c/sample-project/.env
info  - Using external babel configuration from /mnt/c/Develop/sample-project/.babelrc
info  - Creating an optimized production build
info  - Compiled successfully

> Build error occurred
TypeError: p.jb is not a function
    at Object.<anonymous> (/mnt/c/Develop/sample-project/node_modules/react-laag/dist/react-laag.cjs.production.min.js:12:248)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Module.require (node:internal/modules/cjs/loader:991:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/mnt/c/Develop/sample-project/node_modules/react-laag/dist/index.js:5:20)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Module.require (node:internal/modules/cjs/loader:991:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.0TEl (/mnt/c/Develop/sample-project/.next/server/pages/_error.js:185:18)
    at __webpack_require__ (/mnt/c/Develop/sample-project/.next/server/pages/_error.js:23:31)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment:

everweij commented 3 years ago

Hi @vikuscz, Thanks for submitting this bug!

I just took a look the build config. I did a little experiment were I used Google's closure compiler to reduce bundle-size. The side-effect was however, that the dependencies 'react' and 'react-dom' got mangled. I've reverted this experiment and configured it to use plain 'ol terser minification. I just did a release (2.0.2), so I expect your production build should now build smoothly.

Please, let me know if this fixes this issue

vikuscz commented 3 years ago

Many thanks for your quick reaction. Yes, it works now with 2.0.2 :-)

everweij commented 3 years ago

Nice! 🙌🏻 If you run into other issues, I'd be happy to know ;)