Skip to content

Commit

Permalink
fix: resolve npm packages that override
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 19, 2020
1 parent 24a840f commit c42196c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src.runtime/npm/mime.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// https://www.npmjs.com/package/mime

// @ts-ignore
import mimeLite from 'mime/lite.js'
import _mime from '_mime'

const mime = { ...mimeLite }
const mime = { ..._mime }

// Adding v1 compat since rollup mocks flatten dependencies
// https://www.npmjs.com/package/mime/v/1.6.0
Expand Down
2 changes: 1 addition & 1 deletion src.runtime/shims/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
global.process = global.process || {}

// TODO: apply only non-existing keys
Object.assign(global.process, require('node-process/browser.js'))
Object.assign(global.process, require('_process/browser.js'))

export default global.process
4 changes: 3 additions & 1 deletion src/presets/nodeless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default {
// Custom
http: r('node/http'),
process: r('shims/process'),
_process: require.resolve('process/browser.js'),

// Browserify
buffer: require.resolve('buffer/index.js'),
Expand All @@ -18,7 +19,8 @@ export default {
// npm
etag: r('mock/noop'),
'mime-db': r('npm/mime-db'),
mime: r('npm/mime')
mime: r('npm/mime'),
_mime: require.resolve('mime/lite.js')
},

inject: {
Expand Down

0 comments on commit c42196c

Please sign in to comment.