-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with esbuild>=0.14.4 #4
Comments
I've tried with esbuild 0.14.8 and vue 3.2.26 and it seems to work, do you have a small reproduction project I can test? |
Sure, i put up a test repo .
The working version loads the component at /demo correctly. |
My understanding of the (messy) import/export mechanism is poor but I made it work by explicitly exporting render and setup functions: const setup = script.setup;
export { script as default, render, setup }; default export must be kept and even the setup function must be explicitly exported. |
Solution is actually very simple: generated script must use cjs export mechanism: - code += "export default script;";
+ code += "module.exports = script"; My fork includes this change and other tweaks and the replacement for the eval function used to read tsconfig.json: I can create a cleaner PR for you to merge it. |
Sorry, just checked out your fork. It's odd because it works fine for me if I replace your fork with my package in your project, I don't get any kind of errors. What node version are you running? |
Now I'm using node v16 but maybe in January I was using v14 (or even v12). |
Esbuild v0.4.14 changes the way export default works to match vue-loader behavior.
From this version on the plugin doesn't work anymore (I'm using it with latest vue@next + vue-router@next).
Issue needs further investigation but I did a simple diff of the bundle generated by ==0.14.3 and >=0.14.4:
maybe this can help in identifying/resolving the problem.
The text was updated successfully, but these errors were encountered: