hupe1980 / gatsby-plugin-material-ui

Gatsby plugin for Material-UI with built-in server-side rendering support
MIT License
136 stars 25 forks source link

Upgrade to Gatsby V3 #66

Closed daugsbi closed 3 years ago

daugsbi commented 3 years ago

Upgraded dependencies to new versions. Load browserslist config from package.json via import instead of node's fs module. Fallback to default config from gatsby.

I couldn't find a way to use .browserslistrc config or gatsby's helper function without reading from the filesystem.

Closes #65

creotip commented 3 years ago

Tried your solution, but it's breaking SSR injection

daugsbi commented 3 years ago

@creotip Did you get an error?

You probably need to build the plugin first, because the generated js files are not in the repository itself

cd node_modules/gatsby-plugin-material-ui
yarn install --frozen-lockfile
yarn run build
creotip commented 3 years ago

Getting the same error: warning WebpackError: Unsafe builtin usage fs.existsSync

iDVB commented 3 years ago

Any updates on this? I can support in testing if needed. We're trying to upgrade to Gatsby 3 and having the same issue.

daugsbi commented 3 years ago

To test it, I've used https://gitpkg.now.sh/.

yarn add 'https://gitpkg.now.sh/daugsbi/gatsby-plugin-material-ui/gatsby-plugin-material-ui?master'

If you have a theme, you can add it to resolutions in your package.json:

 "resolutions": {
        "gatsby-plugin-material-ui": "https://gitpkg.now.sh/daugsbi/gatsby-plugin-material-ui/gatsby-plugin-material-ui?master",
    }

Then I've manually build it in the package folder, because the final js files are not part of the repository:

cd node_modules/gatsby-plugin-material-ui
yarn install --frozen-lockfile
yarn run build

Let me know if this works

pepijn-vanvlaanderen commented 3 years ago

Tested it and works for me!

daugsbi commented 3 years ago

@hupe1980 Any news on this one? Upgrade node in CircleCI is also necessary

hupe1980 commented 3 years ago

@daugsbi I just updated the node version. Can you update your PR please?

hupe1980 commented 3 years ago

@daugsbi The unittest will run again if you add the following:

// gatsby-plugin-material-ui/package.json
 "moduleNameMapper": {
      "material-ui-plugin-cache-endpoint": "<rootDir>/src/__tests__/dummy-styles-provider-props.js",
      "/package.json": "<rootDir>/src/__tests__/dummy-pkg.json"
    }
hupe1980 commented 3 years ago

@daugsbi The e2e tests run on my local pc after I've updated all the dependencies

daugsbi commented 3 years ago

@hupe1980 Thanks a lot :+1:

Can you fix the e2e tests then?

hupe1980 commented 3 years ago

@daugsbi You just have to run yarn upgrade in the root project to update the yarn.lock.

daugsbi commented 3 years ago

Yeah, green looks much better :smile:

Thanks for your instant help