developit / developit/microbundle

Maybe should compile `node_modules` with babel when use inline dependencies

Open
#936 7 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
8.1k
Forks
358
PR merge metrics
No merged PRs in 30d

Description

Now microbundle is use `exclude: 'node_modules/**'` to create babel config, I think it's reasonable when not inline dependencies.
But if use inline dependencies... this options maybe is weird?

```typescript
// foo/bar.js (in node_modules)
module.exports = {a: ()=>console.log('1')}
```

```typescript
// My module
import abc from 'foo/bar.js';
window.de = abc

export const b = () => {
console.log('2')
}
```

Then add `foo` module to `devDependencies`.

Result:
```typescript
window.de={a:()=>console.log("1")};var o=function(){console.log('2')};export{o as b};
```
If i use inline dependencies mean **i hope it's part of mine module**, my modules arrow function has compile (it's right) but `foo` modules has nothing change.

Maybe should not set `exclude: 'node_modules/**'` when use inline dependencies?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the inline-dependency example using foo/bar.js and the My module, then trace how the Babel config applies exclude: 'node_modules/**'. Compare the output for the dependency and the local arrow function. Done means inline dependencies receive the intended Babel compilation without changing the behavior for non-inlined dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.