Open lebadapetru opened 3 years ago
Hi there!
yea, that’s a deep error from Webpack itself :/. I’m sorry to say that, at first glance, I also don’t have any ideas - I know Webpack pretty well, but that stacktrace doesn’t contain any hints. Otherwise, though I don’t have much personal experience with a typescript + vue setup, your config looks boring (in a good way)
I upgraded the webpack to 1.5.0 but this problem still persist. I managed to find a similar issue here .
When i run npm run watch
it compiles without any error, but if i change anything it throws a list of errors in the .ts files that i have imported in the .vue components. The errors do not make any sense though:
error in /Users/lebadapetrudecebal/Projects/erp/resources/ts/helpers.ts 5:11:46 PM
[tsl] ERROR in /Users/lebadapetrudecebal/Projects/erp/resources/ts/helpers.ts(2,8)
TS2339: Property '__file' does not exist on type '{}'.
error in /Users/lebadapetrudecebal/Projects/erp/resources/views/products/components/lists/TableView.vue.ts 5:11:46 PM
[tsl] ERROR in /Users/lebadapetrudecebal/Projects/erp/resources/views/products/components/lists/TableView.vue.ts(5,10)
TS2614: Module '"resources/ts/helpers"' has no exported member 'setImageSize'. Did you mean to use 'import setImageSize from "resources/ts/helpers"' instead?
error in /Users/lebadapetrudecebal/Projects/erp/resources/views/products/components/lists/TableView.vue.ts 5:11:46 PM
[tsl] ERROR in /Users/lebadapetrudecebal/Projects/erp/resources/views/products/components/lists/TableView.vue.ts(5,24)
TS2614: Module '"resources/ts/helpers"' has no exported member 'getImagePlaceholderPath'. Did you mean to use 'import getImagePlaceholderPath from "resources/ts/helpers"' instead?
helpers.ts:
export const setImageSize = (url: string, width? : number, height?: number): string => {
return url.replace("{widthxheight}", `${width ? width : 150}x${height ? height : ''}`)
}
export const getImagePlaceholderPath = (): string => {
return '/build/media/default-image.jpg'
}
Also, if i go to the helpers.ts AND pagination.ts where those errors are and i simply add a blank space to each file, the watcher compiles them succesfully....
@lebadapetru did you ever find a solution? Running into a similar issue...
@egyptik , my problem was quite a stupid one...
.addEntry('main', './resources/main.js')
i kept the old .js main file instead of replacing it with a .ts file as someone figured out here
Did this fix it for you?
I wanted to confirm that replacing the (in my case) app.js
with app.ts
solved it.
app.js
to app.ts
.addEntry('app', './assets/app.js')
with .addEntry('app', './assets/app.ts')
in webpack.config.js
Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?
I decided to add ts into my working symfony+vue project and so i configured it and ran
npm run watch
which builded successfully, but when i change anything in any .vue or .ts files, the watcher breaks with the following error:tsconfig.json:
webpack.config.js:
It might be something i've missed while configuring it, but since the error doesn't tell me anything...it's hard to figure it out.