Skip to content

Releases: nuxt/module-builder

v1.0.1

08 Apr 16:08
7a43cbf
Compare
Choose a tag to compare

compare changes

📖 Documentation

  • Add full v1 release notes (#581, #582)
  • Update to latest recommendations (6b30cde)

❤️ Contributors

v1.0.0

04 Apr 22:49
b0655d3
Compare
Choose a tag to compare

With the release of unbuild v3, the EOL status of Nuxt 2, and looking forward to Nuxt 4, we're taking the opportunity to release v1 of @nuxt/module-builder, with a range of breaking changes.

⚠️ Breaking Changes

  • Upgrade to unbuild v3 (#447)
    This major upgrade brings significant changes to the build proces but should be significantly better.

  • Removal of Node10 module resolution and CommonJS output (#448)
    As Nuxt 2 has reached EOL, we no longer generate CJS by default, and we have also removed the 'CJS bridge' feature that polyfilled __filename and __dirname.

  • Type errors. The module builder will now error if there are type errors when generating your runtime/* files. (Previously warnings were logged but your build would have succeeded.) Errors you receive aren't caused by the upgrade, but you might need to correct any issues before your module will build again.

🚧 Migration Guide

Replacing __filename and __dirname

We no longer polyfill these CommonJS variables. Instead, use the createResolver utility from @nuxt/kit:

import { createResolver } from '@nuxt/kit'

// Instead of __dirname and __filename
const resolver= createResolver(import.meta.url)
const runtimeDir = resolver.resolve('./runtime')

Module Resolution Changes

We no longer officially support Node10 module resolution, meaning you should remove the types/type field from your package.json. If you need to maintain compatibility with older Node.js versions or systems expecting CommonJS, you can use the typesVersions field in your package.json.

This field allows typing subpath exports (like my-module/utils) even with older moduleResolution settings. Regardless, we recommend all Nuxt users to use Bundler module resolution.

{
  "typesVersions": {
    "*": {
      ".": [
        "dist/index.d.mts"
      ],
      "some-subpath": [
        "dist/some-subpath.d.mts"
      ]
    }
  }
}

ESM-only Output

We no longer generate CommonJS (.cjs) output files by default, as this was primarily needed for Nuxt 2 compatibility. You should:

  • Set "type": "module" in your package.json
  • Update any mentions of .cjs files in your package.json

For example:

+ "type": "module",
  "exports": {
    ".": {
-    "types": "./dist/types.d.ts",
+    "types": "./dist/types.d.mts",
      "import": "./dist/module.mjs",
-     "require": "./dist/module.cjs"
    },
-   "./utils": {
-     "types": "./dist/utils.d.mts",
-     "import": "./dist/utils.mjs",
-     "require": "./dist/utils.cjs"
+   "./utils": "./dist/utils.mjs"
  },
- "main": "./dist/module.cjs",
+ "main": "./dist/module.mjs",
- "types": "./dist/module.d.ts",
+ "typesVersions": {
+   "*": {
+     ".": [
+       "./dist/types.d.mts"
+     ],
+     "utils": [
+       "./dist/utils.d.mts"
+     ]
+   }
+ },
  "files": [
-   "utils.d.ts"
    "dist"
  ],

Configuring unbuild

You can still customize the build process by extending the unbuild configuration in your buildOptions.

To customize/extend the unbuild configuration you can add a build.config.ts in the root of your project:

import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
  // set additional configuration or customize using hooks
  rollupOptions: {
    // for example, if you wish to continue to generate `.cjs` output
    emitCJS: true
  }
})

✨ Changelog

compare changes

🚀 Enhancements

  • ⚠️ Upgrade to unbuild v3 (#447)
  • ⚠️ Remove support for node10 resolution + cjs (#448)
  • build: Ignore test + story files in runtime/ directory (#480)
  • Add support for type exports in module re-exports (#563)

🩹 Fixes

  • Mark nuxi as optional peerDep (29a42ae)
  • Drop @nuxt/kit peer dependency & remove optionality for nuxi (5936063)
  • build: Handle windows path names (#399)
  • build: Apply resolved tsconfig to dts (#462)
  • Handle node10 resolution + add attw test (7309198)
  • Update warnings (6291cbe)
  • Support more than one line of type exports (0c0020f)
  • Split re-exports across multiple lines (7154a89)
  • Support star exports (8966047)

📖 Documentation

  • Update example build script (#359)
  • Update link to downloads count badge (9804e9e)
  • Describe configuring unbuild (#440)

🏡 Chore

  • Use tinyexec in test suite (7ff8ef1)
  • Fix links (2e57eb2)
  • Pin typescript until issue with vue-tsc is resolved (994135d)
  • Bump vue-tsc (e8cb0ef)
  • Bump nuxi version (5b1f00e)
  • Add publint to dev dependencies (7281ae3)
  • Set node versions and enable knip (1a17c0c)
  • Stub module before stubbing playground (b3a513b)
  • Run install command to relink binaries (932729e)
  • Update command and add builder to workspace (#482)
  • Add type assertion (14d7788)
  • Add more type-safe solution + fallback (66d4231)
  • Add pkg.pr.new for nightly/pr builds (#573)
  • Bump to latest mkdist and add vue-sfc-transformer (673152a)
  • Update knip config (c9a28a0)
  • Bump vue-sfc-transformer version (3cd9cd4)
  • release: V1.0.0 (b0655d3)

✅ Tests

  • Await file snapshot assertions (16930b4)
  • Assert current vue snapshot behaviour (#444)
  • Update snapshots (847d150)

🤖 CI

  • Don't run publint on windows (330f412)
  • Prepare environment in lint step (5f0f88f)
  • Force latest corepack (9d74ce4)

⚠️ Breaking Changes

  • ⚠️ Upgrade to unbuild v3 (#447)
  • ⚠️ Remove support for node10 resolution + cjs (#448)

❤️ Contributors

v0.8.4

10 Sep 20:01
d529d7f
Compare
Choose a tag to compare

compare changes

🩹 Fixes

  • Remove nuxt/schema augment (2a20ed0)

❤️ Contributors

v0.8.3

13 Aug 12:13
6349953
Compare
Choose a tag to compare

compare changes

🩹 Fixes

  • build: Handle missing named type exports (#331)

❤️ Contributors

v0.8.2

13 Aug 09:28
07f27bb
Compare
Choose a tag to compare

compare changes

🔥 Performance

  • Removed unnecessary hasTypeExport check (#310)

🩹 Fixes

  • prepare: Override compatibilityDate (b9b27c3)

❤️ Contributors

v0.8.1

28 Jun 16:04
a125b94
Compare
Choose a tag to compare

compare changes

🩹 Fixes

  • build: Export all types in stub mode (6b1970d)

🏡 Chore

❤️ Contributors

v0.8.0

19 Jun 08:54
c122730
Compare
Choose a tag to compare

compare changes

🩹 Fixes

  • ⚠️ Do not augment nuxt options inside module entry (#295)
  • build: Do not export default as a type (d29337c)
  • build: Only generate import type statement if required (190bff4)

⚠️ Breaking Changes

  • ⚠️ Do not augment nuxt options inside module entry (#295)

❤️ Contributors

v0.7.1

11 Jun 17:05
2b4c726
Compare
Choose a tag to compare

compare changes

🩹 Fixes

  • build: Declare ModuleOptions in correct place (#283)

📖 Documentation

  • Update path for runtime js files (#282)

❤️ Contributors

v0.7.0

22 May 16:16
775022a
Compare
Choose a tag to compare

compare changes

🚀 Enhancements

  • Auto generate module options from schema meta (#33)

🩹 Fixes

  • Use tsconfck to resolve tsconfig compilerOptions (#274)
  • ⚠️ Use .js extension for files in runtime/ directory (dbd05bb)
  • Resolve full path to runtime externals (#275)
  • Include dist/runtime in externals list (0946c04)

📖 Documentation

  • Add types condition to export subpath (#265)

🏡 Chore

✅ Tests

  • Add additional test for validity of types shared from runtime (afc4374)

🤖 CI

  • Adds reproduction workflow (0dc73bb)

⚠️ Breaking Changes

  • ⚠️ Use .js extension for files in runtime/ directory (dbd05bb)

❤️ Contributors

v0.6.0

25 Apr 22:15
3b805ec
Compare
Choose a tag to compare

compare changes

🚀 Enhancements

  • Generate runtime/ dts based on nuxt tsconfig options (#255)
  • Add builder versions to module.json (f8567a3)
  • Support transforming jsx (4841f2e)

🩹 Fixes

  • ⚠️ Remove support for deprecated RuntimeModuleHooks interface (#228)
  • Add -nightly versions to externals (0a88a87)
  • Ignore exporting type if it is not defined (c308cc5)
  • Mark runtime/ directory as external (7a68e1e)

🏡 Chore

  • Dedupe kit/schema/vue versions (aa0a710)
  • Add root dev:prepare command (c308a68)
  • Migrate to eslint v9 (#250)
  • Improve internal type safety and enable strict mode (78aa088)
  • Tweak tsconfig settings (404aae7)
  • Add more type annotations (ba0614b)

✅ Tests

  • Update type testing step (#256)
  • Add inline snapshots for runtime/ transforms (#257)
  • Update snapshot (a39c183)

⚠️ Breaking Changes

  • ⚠️ Remove support for deprecated RuntimeModuleHooks interface (#228)

❤️ Contributors