Skip to content
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

ts loader not worknig for server middleware? #14

Open
sweetim opened this issue Sep 13, 2018 · 3 comments
Open

ts loader not worknig for server middleware? #14

sweetim opened this issue Sep 13, 2018 · 3 comments

Comments

@sweetim
Copy link

sweetim commented Sep 13, 2018

I try to write a simple serverMiddlerware using a .ts, but it complains

interface Student {
            ^^^^^^^
  SyntaxError: Unexpected identifier

for reference my sample.ts file is below

interface Student {
    name: string
}

const a: Student = {
    name: 'hhehe'
}

console.log(a)

and in the nuxt.config.js, i set the serverMiddleware as below

serverMiddleware: [
  '~/api/sample.ts'
]

may I know how to resolve this problem?

@sweetim sweetim changed the title ts loader not worknig in server middlewar? ts loader not worknig for server middleware? Sep 13, 2018
@wagerfield
Copy link
Owner

@sweetim as per my comment in #15 I will be updating this module to support Nuxt 2.0 over the next few days, so I'll get back to you on this as and when I have done so.

@sweetim
Copy link
Author

sweetim commented Sep 25, 2018

@wagerfield awesome!

this issue might be related to this nuxt/nuxt#3948

@JuniperChicago
Copy link

JuniperChicago commented Oct 12, 2018

I found setting "module": "es2015" in tsconfig.json worked for a typescript file. It compiles once, so in nuxt dev mode, serverMiddleware file changes will not hot-reload, but otherwise it seems to work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants