N
N
Nikita2019-07-04 09:23:19
JavaScript
Nikita, 2019-07-04 09:23:19

Webpack error on initial build but stable on hot-reload?

There is a large Vue project written partly in TS and partly in JS. Everything works stably in it, we are gradually switching completely to TS, but that's not the point.
I am making a widget for one of the pages of this project. The script is embedded, the Vue application is initialized. The main component has only external layout and functionality, and smaller (stupid) components are imported directly from the project files (since the widget is deployed in parallel with the main project, but not the point). Some components are imported via index.ts:

import ButtonCanRequest from '@/presets/button/can-request';

And some - directly by a file (that is, ordinary JS): So, to the problem. When assembling the widget, it generates hundreds of errors of this format - it only swears at files with the *.vue extension (by the way, the Datepicker.vue file in the widget is not imported and is not used):
import ExtLink from '@/components/ext/Link.vue';
Module build failed: Error: Could not find file: '[project]\src\components\form\Datepicker.vue'.
at getValidSourceFile ([project]\node_modules\typescript\lib\typescript.js:114896:23)
at Object.getEmitOutput ([project]\node_modules\typescript\lib\typescript.js:115259:30)
at Object.getEmitOutput ([ project]\node_modules\ts-loader\dist\instances.js:155:41)
at getEmit ([project]\node_modules\ts-loader\dist\index.js:172:35)
at successLoader ([project]\node_modules \ts-loader\dist\index.js:42:11)
at Object.loader ([project]\node_modules\ts-loader\dist\index.js:29:12)

The most interesting thing is that if you remove all components from the layout, comment out the imports, the assembly will proceed normally. And then return all imports and layout to their place - hot-reload will work and everything will work without errors! The third hour I fight with this problem. I tried to update modules, loaders, changed the webpack configuration a little, everything is useless. Where to dig, who can come across?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question