Skip to content

Production build fails with global SCSS files #1

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

Closed
peteorpeter opened this issue Jun 27, 2019 · 3 comments
Closed

Production build fails with global SCSS files #1

peteorpeter opened this issue Jun 27, 2019 · 3 comments
Labels

Comments

@peteorpeter
Copy link

The production build fails when there are global SCSS files imported.

Minimal repo for reproducing: https://github.com/peteorpeter/gatsby-plugin-scss-typescript-test

The error:

TypeError: Cannot read property 'split' of undefined
at CssModule.nameForCondition (/Users/petejones/projects/livefront/gatsby-plugin-scss-typescript-test/node_modules/mini-css-extract-plugin/dist/index.js:77:39)

It's quite possible that this isn't a bug and the solution is to find the right cssLoaderOptions in gatsby-config.js, but I have not found a combination that works.

I have tried a variety of suggestions from webpack-contrib/mini-css-extract-plugin#156 and elsewhere.


To reproduce, clone this repo and run:

yarn
yarn run build
# 💥 BOOM!

The development build runs without error. Commenting out the import of global.scss removes the error in the production build.


Many thanks for developing this plugin! Even if this (maybe) bug were never resolved I'd work around this to keep using typed SCSS modules.

@Debens
Copy link
Owner

Debens commented Jul 5, 2019

Thanks for reporting, and thanks for providing a reproducible environment! <3

I'll have a dig over the weekend!

For now try adding some options to loader, long shot, but might as well shoot eh?

{
        resolve: 'gatsby-plugin-scss-typescript',
        options: {
            cssLoaderOptions: {
                importLoaders: 1,
            },
        },
    }

@Debens
Copy link
Owner

Debens commented Jul 8, 2019

Take a look at using release v4.0.0, but note there are some breaking changes.

@Debens Debens closed this as completed Jul 8, 2019
@peteorpeter
Copy link
Author

🎊

Global SCSS is working great for me with v4. Many thanks @Debens!

@Debens Debens added the Bug label Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants