Closed existe-deja closed 10 months ago
You can move them into ~/src/runtime
.
Ok but by default the build only expose the module file, should I update the package.json exports ?
I figured out why it wasn't working. I was using yarn link
to simulate the installation and I didn't build the module so the dist files weren't correctly exposed.
Well it's not fully solved as vscode still warns me
Cannot find module '@my-org/my-module/i18n' or its corresponding type declarations
import { localeCodes } from '@my-org/my-module/i18n
But in my package.json of the module I have:
"exports": {
".": {
"types": "./dist/types.d.ts",
"import": "./dist/module.mjs",
"require": "./dist/module.cjs"
},
"./i18n": {
"types": "./dist/runtime/i18n/config/index.d.ts",
"import": "./dist/runtime/i18n/config/index.mjs"
}
}
The project starts but the vscode error is still present. What am I missing? :thinking:
The issue you're facing is that you probably have the old legacy TS module resolution mode still active. In a Nuxt project, you can set experimental.typescriptBundlerResolution
to true.
Hi,
I need to centralize come constant files for locale definitions. I need those files to be available before runtime because I need them to specify my nuxt.config file.
Before the module template I built them wth a custom rollup script and exposed them in my package.json file. Now I don't really know how to do it.
To be explicit I want to do something like:
import { localeCodes } from '@my-org/my-module'
Thanks