Skip to content

Commit

Permalink
chore: simplify bundler module resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Jan 4, 2024
1 parent fd7c078 commit 36e531f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 17 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
- name: Install
run: pnpm install

# Required for svelte-check
- name: Build
run: pnpm --filter=./packages/unlazy run build

Expand Down
1 change: 1 addition & 0 deletions packages/nuxt/.nuxtrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
future.typescriptBundlerResolution=true
2 changes: 1 addition & 1 deletion packages/nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"prepack": "nuxt-module-build build",
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build build --stub && nuxi prepare playground",
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
"test:types": "vue-tsc --noEmit"
},
"dependencies": {
Expand Down
15 changes: 4 additions & 11 deletions packages/nuxt/playground/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@ export default defineNuxtConfig({
},
},

future: {
typescriptBundlerResolution: true,
},

typescript: {
shim: false,
tsConfig: {
compilerOptions: {
moduleResolution: 'bundler',
paths: {
'@unlazy/core': ['../../core/src/index.ts'],
'@unlazy/core/*': ['../../core/src/*'],
'unlazy': ['../../unlazy/src/index.ts'],
'unlazy/*': ['../../unlazy/src/*'],
},
},
},
},
})
3 changes: 3 additions & 0 deletions packages/nuxt/playground/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./.nuxt/tsconfig.json"
}
4 changes: 2 additions & 2 deletions packages/nuxt/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default defineNuxtModule<ModuleOptions>({

// Add module options to public runtime config
nuxt.options.runtimeConfig.public.unlazy = defu(
// @ts-expect-error: Maybe not defined
// @ts-expect-error: Can be unknown
nuxt.options.runtimeConfig.public.unlazy,
options,
)
Expand All @@ -51,7 +51,7 @@ export default defineNuxtModule<ModuleOptions>({
nuxt.options.build.transpile.push(resolve('runtime'))

extendViteConfig((config) => {
config.define = config.define || {}
config.define ||= {}
config.define.__UNLAZY_HASH_DECODING__ = true
})

Expand Down
4 changes: 2 additions & 2 deletions packages/nuxt/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "./playground/.nuxt/tsconfig.json",
"include": ["src", "playground"]
"extends": "./.nuxt/tsconfig.json",
"include": ["src"]
}

0 comments on commit 36e531f

Please sign in to comment.