-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding typescript plugin via addPlugin isn't transpiled into js #10619
Comments
Nice to talk to you. I am a developer in China, I like the framework of NUXT very much, But it also brings me some troubles Because we do not know much about the bottom implementation and operating principle of NUXT. I use NUXT2 Will using Vuex reduce performance? |
@danielroe nuxt 2.16, issue remains! |
What makes you think these files should be transpiled? Would you provide a reproduction? Are you using nuxt/typescript-build? |
Just checking this out, this works fine with nuxt/typescript-build, assuming you copy it with It is worth adding that Nuxt 3 has built-in support for TypeScript. |
Yes, i do have nuxt/typescript-build installed: buildModules: [
// https://go.nuxtjs.dev/typescript
'@nuxt/typescript-build',
'@nuxtjs/eslint-module',
'@nuxtjs/vuetify',
'@nuxtjs/date-fns',
'@nuxtjs/composition-api/module',
], And still it doesn't transpile as you said. This is contents of my custom module index.ts: import type { Module } from '@nuxt/types'
import { resolve } from 'path'
const sharedModule: Module = function () {
this.addPlugin({
src: resolve(__dirname, 'lib/plugins/plugin.ts'),
mode: 'client',
})
}
export default sharedModule I also forgot to mention, i'm using this within monorepo: nx + nx-plus/nuxt: ZachJW34/nx-plus#285 |
Here's a working example: https://stackblitz.com/edit/github-gqugvr. |
@danielroe it works, when the module is a part of your app, but in case if you use NX monorepo, there's different folder structure: -apps obviously it's not transpiling external modules/plugins |
Versions
Reproduction
Create a plugin with Typescript and add it via a module with the following code:
Steps to reproduce
see above
What is Expected?
plugin.ts is transpiled into plugin.js
What is actually happening?
The plugin code is copied to the .nuxt build folder as plugin.js but still in typescript instead of javascript.
The text was updated successfully, but these errors were encountered: