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
6 changes: 0 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ export default function loader(
) {
const loaderContext = this

if (!/\.vue(\.html)?$/.test(loaderContext.resourcePath)) {
// ts-loader does some really weird stuff which causes vue-loader to
// somehow be applied on non-vue files... ignore them
return source
}

// check if plugin is installed
if (
!errorEmitted &&
Expand Down
6 changes: 0 additions & 6 deletions src/templateLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ const TemplateLoader: webpack.loader.Loader = function (source, inMap) {
source = String(source)
const loaderContext = this

if (/\.[jt]sx?$/.test(loaderContext.resourcePath)) {
// ts-loader does some really weird stuff which causes vue-loader to
// somehow be applied on non-vue files... ignore them
return source
}

// although this is not the main vue-loader, we can get access to the same
// vue-loader options because we've set an ident in the plugin and used that
// ident to create the request for this loader in the pitcher.
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/process-custom-file/custom-file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions test/fixtures/process-custom-file/process-custom-file.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<div>
<CustomFile />
</div>
</template>
<script>
import CustomFile from './custom-file.svg'
export default {
components: {
CustomFile
}
}
</script>
18 changes: 18 additions & 0 deletions test/template.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,21 @@ test('postLoaders support', async () => {
// class="red" -> class="green"
expect(instance.$el.className).toBe('green')
})

// #1879
test('should allow process custom file', async () => {
const { instance } = await mockBundleAndRun({
entry: 'process-custom-file/process-custom-file.vue',
module: {
rules: [
{
test: /\.svg$/,
loader: 'vue-loader',
},
],
},
})

expect(instance.$el.tagName).toBe('DIV')
expect(instance.$el.innerHTML).toMatch('ProcessedCustomFile')
})