-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Next.js 8 compatibility #8
Comments
@azizhk @tsirlucas I just tested this plugin with v8 canary-17 and had no problems, can you confirm? |
I did not test with https://github.com/tsirlucas/next-transpile-errors though, will try in a moment Edit: could reproduce it, investigating |
For our codebase solution provided here works well (next@8.0.0-canary.17) |
Great, thank you for the feedback, I will add this change to the plugin, test a little bit more and draft a new release then. Out of curiosity:
|
We are using google cloud functions for nextjs apps hosting, and one issue is too long cold start time - near 6-8 sec with current nextjs version. Seems like a lot of loadable dependencies have gone from next@canary in release version, (no webpack etc) So I'm checking now cold start times improvements have no results yet, just started
We are using yarn with |
Thank you for the feedback! |
Can you confirm |
At least for our app all is working with 1.1.0 |
I will let this issue open until Next.js 8 is officially released. |
Hey @martpie, all import errors are gone now. Thanks for the quick fix and sorry for the delay to answer! The sample repo still have an error but I guess its related to babel/webpack an not to this plugin. Will try to fix everything and ping you if I notice that the problem its here. |
I guess we can close this then. Feel free to comment if you face additional problems. |
Hey @martpie, I tried to fix the errors but had no success. I'll give you some more intel: Why use Next Canary? I'm trying to deploy to now 2.0 with a serverless setup and the canary version added the Can I know more about your setup? The repo I created adds an Before the files imported inside the library were with wrong paths, but after your fixes they're ok. We still get the error that we used to have when deploying to now 2.0, but if we are using the canary version, it does happen when you run The error we are getting:
Maybe the error is related to how next bundles the application for serverless deployment? Running |
Hi @martpie, Relevant Next.js code: Relevant next-plugin-transpile-modules code: We might want to add our external function if |
I am not sure to know what you mean @azizhk, would you mind submitting a PR? :) Then we can ask @tsirlucas to test the branch :) |
Ok, I'll see if I can figure it out. I won't get some time to give a PR this week but will try by next week. |
If this error is related to now 2.0, I am going to open a specific issue for it. |
I think it is mostly related to serverless support than now 2. If you run the dev command with serverless target, the build will fail on the newer versions. Even locally. |
I had to apply this change to make Material-UI documentation works with Next.js v8. |
@oliviertassinari This change was released in |
I have it happily working in Next 8. It took some work to make I couldn't quite drill down to why, but suspected the aliasing was incorrect for nested modules. For those googling, I added to the default babel plugins in const withPlugins = require('next-compose-plugins');
const withTypescript = require('@zeit/next-typescript');
const withTM = require('next-transpile-modules');
module.exports = withPlugins(
[
[
withTM,
{
transpileModules: ['@expo/react-native-responsive-image'] // Replace as needed
}
],
withTypescript
],
{
webpack: (config, { defaultLoaders }) => {
// Alias all `react-native` imports to `react-native-web`
config.resolve.alias = {
...(config.resolve.alias || {}),
'react-native$': 'react-native-web'
};
defaultLoaders.babel.options.plugins = [
['react-native-web', { commonjs: true }]
];
return config;
},
}
);
{
"presets": ["next/babel", "@zeit/next-typescript/babel"],
"plugins": [
[
"module-resolver",
{
"root": ["./"],
"alias": {
"^react-native$": "react-native-web"
}
}
]
]
} |
For anyone following the trails here and still having problems after @heysailor v.helpful post above - ensure the package being transpiled hasn't been hoisted by yarn if using a workspace. Add a (also ensure you are using a |
@elmpp but what I need to hoist the package? In order to not have version clashes between packages in the repo? |
I've heard reports that this plugin does not work with Next 8 (at the the time in canary version).
Need investigation.
Related: #1
The text was updated successfully, but these errors were encountered: