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

Upgrade nextjs example dependencies #37

Closed
wants to merge 1 commit into from

Conversation

dpeek
Copy link
Contributor

@dpeek dpeek commented Mar 23, 2021

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.

@dpeek
Copy link
Contributor Author

dpeek commented Mar 23, 2021

Alternately you could switch to multiple npm packages with css-loader dependency in @style9/next or something...

@johanholmerin
Copy link
Owner

johanholmerin commented Mar 23, 2021

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.

@dpeek
Copy link
Contributor Author

dpeek commented Mar 23, 2021

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?

@johanholmerin
Copy link
Owner

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 }];

@johanholmerin
Copy link
Owner

Fixed in 0.10.3

@dpeek
Copy link
Contributor Author

dpeek commented Mar 27, 2021

Many thanks :)

@dpeek dpeek deleted the upgrade-nextjs-deps branch March 27, 2021 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants