#Identifier 'h' has already been declared

3 messages · Page 1 of 1 (latest)

olive mason
#

I have a vue component entry which import a uglified js file whose code has a 'var h = ....', nuxt auto inject a import h clause in dev mode, so I get the error, please help me how to avoid this .
The imports and nitro.imports config not work

graceful isle
#

@olive mason can you provide a reproduction?

olive mason
# graceful isle <@851381624586502145> can you provide a reproduction?

Solved by myself. I have a lib monorepo. The sub pkgs in packages folder and the nuxt app is a doc site in docs folder. Nuxt injected the import 'h' to all the dist files in packages. While debugging, I found that in 'nuxt:imports-transform' plugin, nuxt transformed files with id like '/UserFolder/project/packages/lib-name/dist/file.js' and try to inject auto-import code by unimport。So I solved the problem by setting imports.transform.exclude in nuxt.config.ts。 Thank you very much all the same