Closed rriski closed 3 years ago
Is it a setting elsewhere that affects it? For example, the sideEffect
of package.json.
Can you try your code with a simple project at https://github.com/SolidZORO/mkn ?
Alright I think I figured what the issue is but no solution yet. My repo is organized with yarn workspaces and antd Table is imported only in @app/components an not in @app/client (next.js app that contains next.config.js). @app/client imports my custom table component that utilizes antd table import { ServerPaginatedTable } from "@app/components";
. If I include import "antd/lib/table/style";
in _app.tsx the table styles are bundled into the final bundle. I also tried to use next.js's webpack 5 support by specifying future: { webpack5: true },
in next.config but I get an error TypeError: Cannot read property 'findIndex' of undefined
thrown from next-plugin-antd-less/index.js:45:46.
Coming back to the webpack 5 issue. Specifying future: { webpack5: true },
in https://github.com/SolidZORO/mkn project next.config.js break at line rules[1].oneOf
because of https://github.com/vercel/next.js/blob/8f21c283b27357dbb2aebe94587901b6c7f4fe64/packages/next/build/webpack-config.ts#L892. The oneOf definition is at index 2 if webpack 5 is enabled.
Reproduction:
Specify future: { webpack5: true },
in https://github.com/SolidZORO/mkn next.config.js.
Would you consider adding support for next.js webpack 5 mode? next-transpile-modules
does it via a unstable_webpack5
flag.
I tried it briefly and found a lot of problems.
so I'm not going to support webpack5 now, I'll wait for webpack5 to become the default and then I'll support it.
I was also investigating webpack 5 issues a bit but when I downgraded to using webpack 4 I kep getting
error - /node_modules/antd/lib/style/index.less ((webpack)/css-loader/cjs.js??ref--5-oneOf-3-1!(webpack)/postcss-loader/cjs.js??ref--5-oneOf-3-2!(webpack)/resolve-url-loader??ref--5-oneOf-3-3!/Users/timo/code/prodeko/ilmo/node_modules/less-loader/dist/cjs.js??ref--5-oneOf-3-4!/Users/timo/code/prodeko/ilmo/node_modules/antd/lib/style/index.less)
(RUN) @app/server: TypeError: this.getOptions is not a function
I figured this was due to changes in less-loader@8.0.0 since yarn resolutions
"resolutions": {
"less-loader": "7.3.0"
},
Compiled correctly for me. On their Github page, less-loader notes that minimum webpack version for less-loader@8.0.0
is 5: https://github.com/webpack-contrib/less-loader/releases/tag/v8.0.0. less-loader@8.0.0 is marked as a dependency of this package.
yes! this plugin update less-loader to 8.0.0 at today.
u can try yarn install --force
Hi @rriski, have you found a solution ? I’m having the same issue using workspaces and postgraphile starter. Thanks for your help !
Hey, I'm trying to replace @zeit/next-less with this plugin. Everything works fine in development but production build is missing css for some components. For example Button has css but Table css does not get included in the css bundle.
next.config.js:
.babelrc:
_app.tsx:
styles.less
package.json
Any ideas what might be wrong with this setup?