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

Commit c661012

Browse files
committed
feature: enable source maps by default
1 parent c240d71 commit c661012

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ const preprocessor = (options = {}) => {
9090
},
9191
})
9292

93+
if (webpackOptions.devtool !== false) {
94+
webpackOptions.devtool = 'inline-source-map'
95+
}
96+
9397
log(`input: ${filePath}`)
9498
log(`output: ${outputPath}`)
9599

test/index_spec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,20 @@ describe('webpack preprocessor', function () {
111111
})
112112
})
113113

114+
it('enables inline source maps', function () {
115+
return this.run().then(() => {
116+
expect(webpack.lastCall.args[0].devtool).to.equal('inline-source-map')
117+
})
118+
})
119+
120+
it('does not enable inline source maps when devtool is false', function () {
121+
this.options.webpackOptions = { devtool: false }
122+
123+
return this.run().then(() => {
124+
expect(webpack.lastCall.args[0].devtool).to.be.false
125+
})
126+
})
127+
114128
it('runs when shouldWatch is false', function () {
115129
return this.run().then(() => {
116130
expect(this.compilerApi.run).to.be.called

0 commit comments

Comments
 (0)