Skip to content

Commit

Permalink
fix: webpack-preprocessor-lazy-load - React lazy load breaks webpack …
Browse files Browse the repository at this point in the history
…config

fix: webpack-preprocessor-lazy-load - React lazy load breaks webpack config
  • Loading branch information
vtereshyn committed Jan 20, 2021
1 parent 012d58c commit 685f11e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions npm/webpack-preprocessor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ const preprocessor: WebpackPreprocessor = (options: PreprocessorOptions = {}): F
output: {
path: path.dirname(outputPath),
filename: path.basename(outputPath),
...(options.webpackOptions?.output ?? {}),
},
})
.tap((opts) => {
Expand Down
14 changes: 14 additions & 0 deletions npm/webpack-preprocessor/test/unit/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,20 @@ describe('webpack preprocessor', function () {
})
})

it('adds output options when user output options are non-default', function () {
const options = { webpackOptions: { output: { publicPath: '/' } } }

return this.run(options).then(() => {
expect(webpack).to.be.calledWithMatch({
output: {
path: 'output',
filename: 'output.js',
publicPath: '/',
},
})
})
})

describe('devtool', function () {
beforeEach((() => {
sinon.stub(typescriptOverrides, 'overrideSourceMaps')
Expand Down

0 comments on commit 685f11e

Please sign in to comment.