Skip to content

Commit

Permalink
feat: v15 support experimental inline match resource
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromehan committed Sep 27, 2023
1 parent a9ccf7e commit 860b660
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion test/advanced.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ test('expose file basename as __file in production when exposeFilename enabled',
)
})


test('extract CSS', done => {
bundle({
entry: 'extract-css.vue',
Expand Down
4 changes: 2 additions & 2 deletions test/edgeCases.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test('test-less oneOf rules', done => {
config.module.rules = [
{
test: /\.vue$/,
use: [DEFAULT_VUE_USE],
use: [DEFAULT_VUE_USE]
},
{
oneOf: [
Expand Down Expand Up @@ -98,7 +98,7 @@ test('normalize multiple use + options', done => {
modify: config => {
config.module.rules[0] = {
test: /\.vue$/,
use: [DEFAULT_VUE_USE],
use: [DEFAULT_VUE_USE]
}
}
}, () => done(), true)
Expand Down
2 changes: 1 addition & 1 deletion test/style.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ test('CSS Modules Extend', async () => {
config.module.rules = [
{
test: /\.vue$/,
use: [DEFAULT_VUE_USE],
use: [DEFAULT_VUE_USE]
},
{
test: /\.css$/,
Expand Down
12 changes: 6 additions & 6 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const VueLoaderPlugin = require('../lib/plugin')
const DEFAULT_VUE_USE = {
loader: 'vue-loader',
options: {
experimentalInlineMatchResource: Boolean(process.env.INLINE_MATCH_RESOURCE),
},
experimentalInlineMatchResource: Boolean(process.env.INLINE_MATCH_RESOURCE)
}
}

const baseConfig = {
Expand Down Expand Up @@ -56,7 +56,7 @@ function bundle (options, cb, wontThrowError) {
if (!options.experiments || !options.experiments.css) {
config.module && config.module.rules && config.module.rules.push({
test: /\.css$/,
use: ['vue-style-loader', 'css-loader'],
use: ['vue-style-loader', 'css-loader']
})
}
if (config.vue) {
Expand All @@ -65,7 +65,7 @@ function bundle (options, cb, wontThrowError) {
experimentalInlineMatchResource: Boolean(
process.env.INLINE_MATCH_RESOURCE
),
...options.vue,
...options.vue
}
delete config.vue
const vueIndex = config.module.rules.findIndex(r => r.test.test('.vue'))
Expand All @@ -76,12 +76,12 @@ function bundle (options, cb, wontThrowError) {
// Vue usually locates at the first loader
if (vueRule.use && typeof vueRule.use[0] === 'object') {
vueRule.use[0] = Object.assign({}, vueRule.use[0], {
options: vueOptions,
options: vueOptions
})
}
} else {
config.module.rules[vueIndex] = Object.assign({}, vueRule, {
options: vueOptions,
options: vueOptions
})
}
}
Expand Down

0 comments on commit 860b660

Please sign in to comment.