Closed dpeek closed 3 years ago
Alternately you could switch to multiple npm packages with css-loader dependency in @style9/next or something...
Next.js started bundling css-loader in version 10. Instead of using a different version, we should probably try to resolve next/dist/compiled/css-loader
, and if it doesn't exist, go back to css-loader
.
Otherwise looks good.
I don't think css-loader is required directly by style9, only referenced as a string in the next plugin... seems weird that it wouldn't find the next version already?
Could you explain how I would try to resolve the next version?
I was thinking something like this:
const cssLoader = (() => {
try {
// v10+
return require.resolve('next/dist/compiled/css-loader')
} catch (_) {
return 'css-loader';
}
})();
// ...
const outputLoaders = [{ loader: cssLoader }];
Fixed in 0.10.3
Many thanks :)
Upgrades next, react and next-transpile-modules dependencies in example/nextjs to latest.
Adds css-loader as a library dependency – not sure why this only errors after the upgrade, but as it is a dependency of the webpack loader I suppose it should be? Either that or it could be a peerDependency... happy to update if needed.