Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Assemble in line function #33

Closed
eddyerburgh opened this issue Dec 16, 2017 · 4 comments
Closed

Assemble in line function #33

eddyerburgh opened this issue Dec 16, 2017 · 4 comments
Assignees

Comments

@eddyerburgh
Copy link
Member

At the moment, assemble requires an import/require string for the script.

Not all compilers require this feature, and it makes the process more complicated. For example, vueify and vue-jest can work with the script being inlined.

I propose we add an assembleInline function that returns an es6/cjs module that doesn't include import/require statements.

assembleInline would need to be passed the transformed code, and source maps.

@znck
Copy link
Member

znck commented Dec 16, 2017

I felt same when I was looking at parcel code.

@yyx990803 yyx990803 mentioned this issue Dec 16, 2017
13 tasks
@znck znck self-assigned this Dec 21, 2017
@znck
Copy link
Member

znck commented Dec 21, 2017

Contents of <script> tag would be an ES or CJs module. The default export from <script> is required in normalizeComponent.

Approach 1: Search and replace export default with var __script__ = .
Approach 2: Parse to AST and convert default export to __script__ variable.

@eddyerburgh What do you think, which way to proceed? Any other suggestions?

@znck
Copy link
Member

znck commented Dec 29, 2017

@eddyerburgh for inline assemble, can import statements for other javascript dependencies be added?

@eddyerburgh
Copy link
Member Author

I think they shouldn't be

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants