Skip to content

How to fix code in NAPI? #478

Answered by HerringtonDarkholme
Lodin asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, NAPI fix is not shipped now because most JS code needs sourcemap support, which is not supported at the moment.

To replace code, using magic-string is recommended for JS source code manipulation. You may need to write replacement string manually, though.

See https://github.com/vue-vine/vue-vine/blob/0d302140f2a0a606cca62a130082952ec183628a/packages/compiler/src/transform.ts#L32-L37 as an example.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Lodin
Comment options

Answer selected by Lodin
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants