Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/pluginWebpack4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ class VueLoaderPlugin implements webpack.Plugin {
const parsed = qs.parse(query.slice(1))
return parsed.vue != null && parsed.type === 'template'
},
options: vueLoaderOptions,
options: {
ident: vueLoaderUse.ident,
...vueLoaderOptions,
},
}

// for each rule that matches plain .js/.ts files, also create a clone and
Expand Down
27 changes: 27 additions & 0 deletions test/edgeCases.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,30 @@ test('should work with i18n loader in production mode', async () => {

expect(result.componentModule.__i18n).toHaveLength(1)
})

// #2029
test('should pass correct options to template compiler', async () => {
const fakeCompiler: any = {
compile: jest
.fn()
.mockReturnValue({ code: 'export function render() { return null; }' }),
}

await mockBundleAndRun({
entry: 'basic.vue',
modify: (config: any) => {
config.module.rules[0].options = {
compiler: fakeCompiler,
}
config.module.rules.push(
...Array.from({ length: 10 }).map((_, i) => ({
test: new RegExp(`\.dummy${i}`),
loader: 'null-loader',
options: { dummyRule: i },
}))
)
},
})

expect(fakeCompiler.compile).toHaveBeenCalledTimes(1)
})