Module starter not working
- Go to
nuxt.new - Create a new nuxt-module using the starter -> codesandbox or stackblitz
- Run
npm i && npm dev:prepare - See error in the in the following details:
stackblitz error
codesandbox error
Solution
I lack of knowledge to know the reason why it fails, but it seems the problem is with addPlugin(resolver.resolve('./runtime/plugin'));
https://stackblitz.com/edit/github-fefin6wf?file=tsconfig.json
Let me know if I am doing something wrong!
the error seems to be cause by not running npm run dev:prepare. are you sure you ran it?
Sorry for the mix-up, I was testing other things and didn't reproduce the problem correctly.
If you open the project directly from StackBlitz it will run automatically:
npm install && npm run dev
and then displays an error. StackBlitz installs dependencies and runs dev for you (See docs.), but it doesn't do the dev:prepare step that dev requires. This can be confusing for someone new to this setup.
What do you think adding postinstall: "npm run dev:prepare" script?
the problem is that the postinstall command would then run when users installed the module
I didn't know postinstall also happens in node_modules.
Then, I don't think of any workaround. Feel free to close this issue if we don't come up with a better DX 😸
we could add it to the dev command instead? "dev": "npm run dev:prepare && nuxi dev playground"
Sure! If I do a PR, it will be automatically updated in the codesandbox and stackblitz, right?
yes 👍