themes-switch
themes-switch copied to clipboard
Doesn't work with hot reload
It looks like it tries to open the temp generated files. Every time I hot reload, I get this error message:
ERROR in ./temp/themes/dark.less
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/less-loader/dist/cjs.js):
Error: ENOENT: no such file or directory, open 'D:\dev\projects\my-project\client\temp\themes\dark.less'
at runLoaders (D:\dev\projects\my-project\client\node_modules\webpack\lib\NormalModule.js:316:20)
at D:\dev\projects\my-project\client\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at Array.<anonymous> (D:\dev\projects\my-project\client\node_modules\loader-runner\lib\LoaderRunner.js:203:19)
at Storage.finished (D:\dev\projects\my-project\client\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at ReadFileContext.provider (D:\dev\projects\my-project\client\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9)
at ReadFileContext.callback (D:\dev\projects\my-project\client\node_modules\graceful-fs\graceful-fs.js:115:16)
at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:242:13)
It shows the error for every theme that exists, so this follows:
ERROR in ./temp/themes/light.less
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/less-loader/dist/cjs.js):
Error: ENOENT: no such file or directory, open 'D:\dev\projects\my-project\client\temp\themes\light.less'
I use latest webpack and Typescript. Did someone notice it too?
If you add clearTemp: false
option to the ThemesGeneratorPlugin
, it works.
@harshithmohan Do you have a working example of this? I tried so many times to make themes-switch
work, but with no luck
@harshithmohan Do you have a working example of this? I tried so many times to make
themes-switch
work, but with no luck
I just saw that using clearTemp: false
makes it not delete the temp folder, so hot reload would work. But I still haven't figured out to make it all work.
I tried to see if building and running it would help but it's generating empty 1 byte css for me. Trying to figure it out since 12 hours but no luck.
May or may not help others: I found that clearTemp: false
needed to be the very first option in the ThemesGeneratorPlugin
for the hot-reloading to work with the themes-switch
plugin.
Friendly reminder to include temp
in your .gitignore
Currently hot-reload has been supported in v1.1.0, now new theme files will be generated when a reload is triggered.