Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit 66f3d04

Browse files
committed
Ensure that the webpack output filename ends with .js.
This ensures that the Webpack SourceMapDevToolPlugin can handle the file, even when it has been originally no javascript file (e.g. .ts or .feature).
1 parent ba9d44c commit 66f3d04

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const preprocessor = (options = {}) => {
8383
entry,
8484
output: {
8585
path: path.dirname(outputPath),
86-
filename: path.basename(outputPath),
86+
filename: `${path.basename(outputPath, '.js')}.js`,
8787
},
8888
})
8989

test/unit/index.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,17 @@ describe('webpack preprocessor', function () {
132132
})
133133
})
134134

135+
it('adds .js extension to filename when the originating file had been no javascript file', function () {
136+
this.file.outputPath = 'output/output.ts'
137+
138+
return this.run().then(() => {
139+
expect(webpack.lastCall.args[0].output).to.eql({
140+
path: 'output',
141+
filename: 'output.ts.js',
142+
})
143+
})
144+
})
145+
135146
it('enables inline source maps', function () {
136147
return this.run().then(() => {
137148
expect(webpack.lastCall.args[0].devtool).to.equal('inline-source-map')

0 commit comments

Comments
 (0)