diff --git a/packages/nuxt3/src/babel-preset-app/index.js b/packages/nuxt3/src/babel-preset-app/index.js index 7735d9ad4b..858d1ef2e3 100644 --- a/packages/nuxt3/src/babel-preset-app/index.js +++ b/packages/nuxt3/src/babel-preset-app/index.js @@ -143,6 +143,8 @@ module.exports = (api, options = {}) => { shippedProposals, forceAllTransforms } + ], [ + require('@babel/preset-typescript') ]) // JSX diff --git a/packages/nuxt3/src/index.ts b/packages/nuxt3/src/index.ts new file mode 100644 index 0000000000..8cb0970ca1 --- /dev/null +++ b/packages/nuxt3/src/index.ts @@ -0,0 +1,3 @@ +export * from './core' + +export const getBuilder = () => import('./builder') diff --git a/packages/nuxt3/src/vue-app/components/index.js b/packages/nuxt3/src/vue-app/components/index.ts similarity index 100% rename from packages/nuxt3/src/vue-app/components/index.js rename to packages/nuxt3/src/vue-app/components/index.ts diff --git a/packages/nuxt3/src/vue-app/index.js b/packages/nuxt3/src/vue-app/index.ts similarity index 100% rename from packages/nuxt3/src/vue-app/index.js rename to packages/nuxt3/src/vue-app/index.ts diff --git a/packages/nuxt3/src/vue-app/nuxt.js b/packages/nuxt3/src/vue-app/nuxt.ts similarity index 100% rename from packages/nuxt3/src/vue-app/nuxt.js rename to packages/nuxt3/src/vue-app/nuxt.ts diff --git a/packages/nuxt3/src/vue-app/nuxt/entry.client.js b/packages/nuxt3/src/vue-app/nuxt/entry.client.ts similarity index 100% rename from packages/nuxt3/src/vue-app/nuxt/entry.client.js rename to packages/nuxt3/src/vue-app/nuxt/entry.client.ts diff --git a/packages/nuxt3/src/vue-app/nuxt/entry.server.js b/packages/nuxt3/src/vue-app/nuxt/entry.server.ts similarity index 100% rename from packages/nuxt3/src/vue-app/nuxt/entry.server.js rename to packages/nuxt3/src/vue-app/nuxt/entry.server.ts diff --git a/packages/nuxt3/src/vue-app/nuxt/plugins.client.js b/packages/nuxt3/src/vue-app/nuxt/plugins.client.ts similarity index 100% rename from packages/nuxt3/src/vue-app/nuxt/plugins.client.js rename to packages/nuxt3/src/vue-app/nuxt/plugins.client.ts diff --git a/packages/nuxt3/src/vue-app/nuxt/plugins.server.js b/packages/nuxt3/src/vue-app/nuxt/plugins.server.ts similarity index 100% rename from packages/nuxt3/src/vue-app/nuxt/plugins.server.js rename to packages/nuxt3/src/vue-app/nuxt/plugins.server.ts diff --git a/packages/nuxt3/src/vue-app/nuxt/plugins.js b/packages/nuxt3/src/vue-app/nuxt/plugins.ts similarity index 100% rename from packages/nuxt3/src/vue-app/nuxt/plugins.js rename to packages/nuxt3/src/vue-app/nuxt/plugins.ts diff --git a/packages/nuxt3/src/vue-app/nuxt/routes.js b/packages/nuxt3/src/vue-app/nuxt/routes.ts similarity index 100% rename from packages/nuxt3/src/vue-app/nuxt/routes.js rename to packages/nuxt3/src/vue-app/nuxt/routes.ts diff --git a/packages/nuxt3/src/vue-app/plugins/components.js b/packages/nuxt3/src/vue-app/plugins/components.ts similarity index 100% rename from packages/nuxt3/src/vue-app/plugins/components.js rename to packages/nuxt3/src/vue-app/plugins/components.ts diff --git a/packages/nuxt3/src/vue-app/plugins/legacy.js b/packages/nuxt3/src/vue-app/plugins/legacy.ts similarity index 100% rename from packages/nuxt3/src/vue-app/plugins/legacy.js rename to packages/nuxt3/src/vue-app/plugins/legacy.ts diff --git a/packages/nuxt3/src/vue-app/plugins/preload.js b/packages/nuxt3/src/vue-app/plugins/preload.ts similarity index 100% rename from packages/nuxt3/src/vue-app/plugins/preload.js rename to packages/nuxt3/src/vue-app/plugins/preload.ts diff --git a/packages/nuxt3/src/vue-app/plugins/router.js b/packages/nuxt3/src/vue-app/plugins/router.ts similarity index 100% rename from packages/nuxt3/src/vue-app/plugins/router.js rename to packages/nuxt3/src/vue-app/plugins/router.ts diff --git a/packages/nuxt3/src/vue-app/plugins/state.js b/packages/nuxt3/src/vue-app/plugins/state.ts similarity index 100% rename from packages/nuxt3/src/vue-app/plugins/state.js rename to packages/nuxt3/src/vue-app/plugins/state.ts diff --git a/packages/nuxt3/src/vue-app/utils.js b/packages/nuxt3/src/vue-app/utils.ts similarity index 100% rename from packages/nuxt3/src/vue-app/utils.js rename to packages/nuxt3/src/vue-app/utils.ts diff --git a/packages/nuxt3/src/webpack/config/base.ts b/packages/nuxt3/src/webpack/config/base.ts index 68c358095b..003e609e92 100644 --- a/packages/nuxt3/src/webpack/config/base.ts +++ b/packages/nuxt3/src/webpack/config/base.ts @@ -217,7 +217,7 @@ export default class WebpackBaseConfig { return { resolve: { - extensions: ['.wasm', '.mjs', '.js', '.json', '.vue', '.jsx'], + extensions: ['.wasm', '.mjs', '.js', '.ts', '.json', '.vue', '.jsx', '.tsx'], alias: this.alias(), modules: webpackModulesDir }, diff --git a/packages/nuxt3/src/webpack/config/client.ts b/packages/nuxt3/src/webpack/config/client.ts index a08c3ad166..d04311b07a 100644 --- a/packages/nuxt3/src/webpack/config/client.ts +++ b/packages/nuxt3/src/webpack/config/client.ts @@ -206,7 +206,7 @@ export default class WebpackClientConfig extends WebpackBaseConfig { // Entry points config.entry = Object.assign({}, config.entry, { - app: [path.resolve(buildDir, 'entry.client.js')] + app: [path.resolve(buildDir, 'entry.client.ts')] }) // Add HMR support diff --git a/packages/nuxt3/src/webpack/config/server.ts b/packages/nuxt3/src/webpack/config/server.ts index 4c1dd27267..7287913eb4 100644 --- a/packages/nuxt3/src/webpack/config/server.ts +++ b/packages/nuxt3/src/webpack/config/server.ts @@ -114,7 +114,7 @@ export default class WebpackServerConfig extends WebpackBaseConfig { target: 'node', node: false, entry: Object.assign({}, config.entry, { - app: [path.resolve(this.buildContext.options.buildDir, 'entry.server.js')] + app: [path.resolve(this.buildContext.options.buildDir, 'entry.server.ts')] }), output: Object.assign({}, config.output, { filename: 'server.js',