Comments (2)
If you want to get all source files that are referenced in the bundle, you can enable metafile and read the Object.keys(metafile.inputs) without using a regex. Or enable sourcemap and parse the mappings.
If your second purpose is to get 'compiled' contents in the bundle by slicing code between these comments, it is not always correct because esbuild may re-order contents in the same file during the scope hoisting process. Which is to say, sources in the same file may not finally become continuous contents in the bundle.
from esbuild.
Thanks for the quick reply @hyrious
My purpose lies with extracting the compiled code.
Just so I can be sure that I understand your second paragraph...
Are you saying that given e.g. the following input files
fileA.js
var message = "Hello"
console.log(message)
fileB.js
var a = true
var b = false
if (a)
{
console.log("A is true")
}
you could end up with a bundle like this:
var message = "Hello"
var a = true
// fileA.js
console.log(message)
// fileB.js
var b = false
if (a)
{
console.log("A is true")
}
If this is correct (i.e. the principle, not the exact code example) then could you explain under what conditions this would happen?
If I've misunderstood could you illustrate what you mean with a code example?
Thanks again.
from esbuild.
Related Issues (20)
- Option to disable injected comment of input path file HOT 2
- Additional directories to watch HOT 3
- esbuild does not fail with undefined functions HOT 5
- Segmentation fault when using with vite and sveltekit project HOT 1
- Glob imports must match exactly
- Pass argument to IIFE HOT 2
- Esbuild causing bundle breakage when applied twice to the same bundle
- Splitting results in `Dynamic require of "<filename>" is not supported` when targeting `chrome62`
- [Feature Request] Add built-in HTML loader HOT 1
- Imports from stdio entrypoint don't have a namespace set
- DCE is not removed when value is from a const in another module.
- Get metafile info from a `watch()` rebuild HOT 2
- removes the backslash "\" when minify option is false HOT 8
- [Sourcemap] Private properties don't get sourcemapped correctly HOT 3
- ENV Secrets accessible from js code in a React + Rails APP. HOT 7
- [Feature] Ability to save charts from Bundle Size Analyzer as svg files
- TypeError: Cannot set property X of #<Object> which has only a getter HOT 2
- Line limit option (lineLimit) breaks code HOT 3
- `esnext` target doesn't transform using declarations but `es2022` does HOT 2
- Default exports not handled correctly when external=true and module is dynamically imported (node16)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esbuild.