Closed eddyerburgh closed 6 years ago
I felt same when I was looking at parcel code.
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?
@eddyerburgh for inline assemble, can import
statements for other javascript dependencies be added?
I think they shouldn't be
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 includeimport
/require
statements.assembleInline
would need to be passed the transformed code, and source maps.