Skip to content

Commit

Permalink
Revert "Disable vue style loader (laravel-mix#2981)"
Browse files Browse the repository at this point in the history
This reverts commit eeb3dd8.
  • Loading branch information
thecrypticace committed Jun 10, 2021
1 parent e13131d commit 31dfed6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/components/CssWebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ class CssWebpackConfig extends AutomaticComponent {
}

if (method === 'inline') {
loaders.push({ loader: 'style-loader' });
if (Mix.components.get('vue') && location === 'default') {
loaders.push({ loader: 'vue-style-loader' });
} else {
loaders.push({ loader: 'style-loader' });
}
} else if (method === 'extract') {
loaders.push({
loader: MiniCssExtractPlugin.loader,
Expand Down
6 changes: 3 additions & 3 deletions test/features/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ test('it knows the Vue 2 compiler name', t => {
t.true(dependencies.includes('vue-template-compiler'));
});

test('DISABLED: it switches to vue-style-loader when not extracting styles', async t => {
test('it switches to vue-style-loader when not extracting styles', async t => {
mix.vue({ version: 2, extractStyles: false });

const config = await webpack.buildConfig();

assert.doesNotHaveWebpackLoader(t, config, 'vue-style-loader');
assert.hasWebpackLoader(t, config, 'style-loader');
assert.hasWebpackLoader(t, config, 'vue-style-loader');
assert.doesNotHaveWebpackLoader(t, config, 'style-loader');
assert.doesNotHaveWebpackLoader(t, config, /mini-css-extract-plugin/);
});

Expand Down
6 changes: 3 additions & 3 deletions test/features/vue3.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ test('it knows the Vue 3 compiler name', t => {
t.true(dependencies.includes('@vue/compiler-sfc'));
});

test('DISABLED: it switches to vue-style-loader when not extracting styles', async t => {
test('it switches to vue-style-loader when not extracting styles', async t => {
mix.vue({ version: 3, extractStyles: false });

const config = await webpack.buildConfig();

assert.doesNotHaveWebpackLoader(t, config, 'vue-style-loader');
assert.hasWebpackLoader(t, config, 'style-loader');
assert.hasWebpackLoader(t, config, 'vue-style-loader');
assert.doesNotHaveWebpackLoader(t, config, 'style-loader');
assert.doesNotHaveWebpackLoader(t, config, loader =>
loader.includes('mini-css-extract-plugin')
);
Expand Down

0 comments on commit 31dfed6

Please sign in to comment.