Skip to content

Commit

Permalink
fix: remove style-loader from the loader chain (#2309)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Jan 5, 2021
1 parent 9084eab commit 19a25cf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
Expand Up @@ -111,9 +111,6 @@ Object {
Object {
"loader": "MiniCssExtractPlugin.loader",
},
Object {
"loader": "\\"style-loader\\"",
},
Object {
"loader": "\\"css-loader\\"",
"options": Object {
Expand Down
5 changes: 2 additions & 3 deletions packages/generators/__tests__/init-generator.test.ts
Expand Up @@ -113,10 +113,9 @@ describe('init generator', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const config = (Object.entries(output)[0][1] as any).configuration.config.webpackOptions;
expect(config.module.rules[0].test).toEqual('/.css$/');
expect(config.module.rules[0].use.length).toEqual(3);
expect(config.module.rules[0].use.length).toEqual(2);
expect(config.module.rules[0].use[0].loader).toEqual('MiniCssExtractPlugin.loader');
expect(config.module.rules[0].use[1].loader).toEqual('"style-loader"');
expect(config.module.rules[0].use[2].loader).toEqual('"css-loader"');
expect(config.module.rules[0].use[1].loader).toEqual('"css-loader"');
//match config snapshot
expect(config).toMatchSnapshot();
});
Expand Down
3 changes: 3 additions & 0 deletions packages/generators/src/init-generator.ts
Expand Up @@ -187,6 +187,9 @@ export default class InitGenerator extends CustomGenerator {
);
}

// Remove style-loader from the loader chain
ExtractUseProps.shift();

ExtractUseProps.unshift({
loader: 'MiniCssExtractPlugin.loader',
});
Expand Down
3 changes: 0 additions & 3 deletions test/init/language/css/init-language-css.test.js
Expand Up @@ -48,9 +48,6 @@ describe('init with SCSS', () => {
{
loader: MiniCssExtractPlugin.loader, // eslint-disable-line
},
{
loader: 'style-loader',
},
{
loader: 'css-loader',

Expand Down

0 comments on commit 19a25cf

Please sign in to comment.