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

Flip "style-loader"/"css-loader" order in @wordpress/scripts webpack example #20251

Merged
merged 2 commits into from
Feb 17, 2020

Conversation

johnwatkins0
Copy link
Member

Description

The "Extending the webpack config" section in the @wordpress/scripts README had exactly the snippet I needed, except css-loader and style-loader needed to switched. When css-loader comes first, I get this error when running wp-scripts build:

ERROR in ./node_modules/react-character-map/dist/component/style.css
Module build failed (from ./node_modules/css-loader/dist/cjs.js):
CssSyntaxError

(1:1) Unknown word

When style-loader is placed first, it works as expected.

How has this been tested?

Verified in my local environment.

Types of changes

Small README-only change.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, the changes you proposed align with what we use with Storybook:

use: [
'style-loader',
'css-loader',
/**
* Configuring PostCSS with Webpack
* https://github.com/postcss/postcss-loader#plugins
*/
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
plugins: () => postCssConfigPlugins,
},
},
'sass-loader',
],

Thank you for opening this PR 🙇

@gziolo gziolo merged commit 07e8b84 into WordPress:master Feb 17, 2020
@gziolo gziolo added [Type] Developer Documentation Documentation for developers [Tool] WP Scripts /packages/scripts labels Feb 17, 2020
@gziolo gziolo added this to the Gutenberg 7.6 milestone Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Tool] WP Scripts /packages/scripts [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants