Skip to content

Commit

Permalink
fix(native deps): not marked as externals if they have index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
nklayman committed Aug 27, 2018
1 parent a99db83 commit 4df3aeb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
9 changes: 0 additions & 9 deletions __tests__/webpackConfig.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,6 @@ describe.each(['production', 'development'])('getExternals in %s', env => {
}
)

test('If dep has index.js it should not be external', async () => {
// Mock existence of index.js
fs.existsSync = jest.fn(file => file === 'mockExternalIndex')
const { externals } = await mockGetExternals()
expect(externals).toBeUndefined()
// Remove mock
fs.existsSync.mockReset()
})

test('If dep is listed in user list it should be an external', async () => {
const { externals } = await mockGetExternals(
// Prevent it from getting marked as an external by default
Expand Down
3 changes: 0 additions & 3 deletions lib/webpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ function getExternals (api, pluginOptions) {
const externalsList = Object.keys(dependencies || {}).filter(dep => {
// Return true if we want to add a dependency to externals
try {
if (fs.existsSync(api.resolve(`./node_modules/${dep}/index.js`))) {
return false
}
const pgkString = fs
.readFileSync(api.resolve(`./node_modules/${dep}/package.json`))
.toString()
Expand Down

0 comments on commit 4df3aeb

Please sign in to comment.