-
Notifications
You must be signed in to change notification settings - Fork 69
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
watch mode error for non-TS files (Handlebars, Vue) #32
Comments
Do you import them? Does it happen in non-watch build? Could you post your rollup config and tsconfig.json? |
I do import them like so: import template from '../Views/Shared/ads.hbs'; with declaration elsewhere: declare module '*.hbs' {
export default function (context: any): string;
} It doesn't happen in a non-watch build. rollup.config.js: import commonjs from 'rollup-plugin-commonjs';
import handlebars from 'rollup-plugin-handlebars-plus';
import json from 'rollup-plugin-json';
import resolve from 'rollup-plugin-node-resolve';
import rootImport from 'rollup-plugin-root-import';
import typescript from 'rollup-plugin-typescript2';
import uglify from 'rollup-plugin-uglify';
const partialRoot = `${__dirname}/src/Views/Shared`;
export default {
output: {
format: 'iife'
},
plugins: [
typescript({ clean: true }),
json(),
resolve(),
commonjs(),
rootImport({ root: partialRoot }),
handlebars({
helpers: '../../ts/handlebars',
partialRoot: partialRoot,
isPartial: () => true
}),
uglify()
]
} tsconfig.json {
"compilerOptions": {
"downlevelIteration": true,
"lib": [
"dom",
"dom.iterable",
"es2017"
],
"moduleResolution": "node",
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"target": "es5"
}
} |
I'm tempted to blame this on handlebars plugin, but just looking at the code I can't tell why it would be failing this way. Is it possible to reduce the problem to a small self-contained repo? |
From the stack trace it seems that the TypeScript library is not recognizing it as a valid source file (which it isn't). Perhaps you could skip non-TypeScript files when walking the tree? I'll try to come up with a smaller example. |
Yeah, I already skip non-typescript files by default, but this is typescript trying to parse typescript file and not finding one of the imports. Every watch round the plugin grabs diagnostics for all typescript files, not just the ones modified in that round. This likely have something to do with the error. Does |
Adding a
Not sure why this only happens in watch mode. I've created a small repo. Use |
Can't reproduce on your repo. Did Running on windows, Is there something specific I need to do to trigger it? |
The handlebars plugin wasn't working on Windows by default, seems there's a bug in it. I've modified the repo to bypass that and now you should be able to reproduce it. |
Heh, you are right, it was trying to load and parse .hbs file. Try now with master branch |
Hah, yeah it seems fine now :D |
Well, I'm experiencing the issue with Vue components. Here's the stack trace.
node: v10.13.0 |
And yes, only in the watch mode. |
@hiendv do you use latest versions of vue plugin and this plugin? |
Yes, I do. |
@hiendv could you make a minimal repo with reproduction? |
I'm on it but it's kinda hard because of the random appearance of the error. |
@ezolenko @ezolenko2 Could you look at this? Thanks. https://github.com/hiendv/rpt2-vue-issue-32 |
Ok, finally got around to it, @hiendv could you check if master works for you? |
I've been testing the master branch for a while. So far so good. I think this is it. Thank you :D |
It's been two days. Everything is fine. I think you can release the patch now. Thank you. |
In 0.18.1 now |
Thank you. |
I import Handlebars template files which should be ignored by the diagnostics.
The text was updated successfully, but these errors were encountered: