parcel-plugin-custom-dist-structure: SCSS Hot Reload fails if options.development: true
Hi there, after scratching my head for awhile today to figure out why the hot reload was no longer working when I made changes to a scss file, I realized that my problems vanished when I set development to false and not have my folders structured while developing.
The styles do update however, if I save my entry file (index.html) in this case.
I am simply including the scss file in the index.html via <link> tag.
Here are my configurations. Note that in this case, everything works as intended. However, if I change the options.development to true in the package.json file, then SCSS hot reloading no longer works.
package.json
{
"name": "example",
"version": "1.0.0",
"description": "Example",
"scripts": {
"start": "parcel ./src/index.html --out-dir build/dev",
"build": "parcel build ./src/index.html --out-dir build/prod"
},
"author": "Chuck Taylor",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"cssnano": "^4.1.10",
"parcel-plugin-custom-dist-structure": "^1.1.3",
"parcel-plugin-nuke-dist": "^1.0.1",
"sass": "^1.26.3",
"typescript": "^3.8.3"
},
"customDistStructure": {
"config": {
"scripts": [
".js",
".js.map"
],
"styles": [
".css",
".css.map"
],
"images": [
".jpg",
".png",
".svg"
]
},
"options": {
"development": false
}
},
"dependencies": {}
}
.browserslistrc
# Supported Browsers
defaults
.babelrc
{
"presets": ["@babel/preset-env"]
}
postcss.config.js
module.exports = {
plugins: [require('autoprefixer'), require('postcss-nested')],
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 24 (13 by maintainers)
Commits related to this issue
- FIX: HMR HMR for some reason was broken with this plugin, but adding `module.hot.accept()` fixes the issue. Resolves #9 — committed to VladimirMikulic/parcel-plugin-custom-dist-structure by VladimirMikulic 4 years ago
- FIX: Page doesn't update on CSS changes Since the plugin manipulates folder structure, it breaks HMR and also breaks page refresh on CSS/SCSS changes. The solution was to import HMR server and trigg... — committed to VladimirMikulic/parcel-plugin-custom-dist-structure by VladimirMikulic 4 years ago
Wellโฆ I have it working finally. ๐ I can confirm that hot-reloading is working just fine, and the folders are being nicely organized even when options.development is set to true.
Iโm not saavy with these symlinks etc (As Iโm sure you gathered), but I am guessing this issue is at play as per the yarn issue I linked to previously.
I finally found
/Users/chuckntaylor/.config/yarn/global/node_modules/parcel-bundler
I navigated there and enteredyarn link
. This gave the following output:Then back in my app root folder I entered
yarn link parcel-bundler
and everything finally clicked.Thank you for your patience, and your time spent troubleshooting an issue outside the scope of your project.
Awesome ๐ Thank you for verifying the changes. Iโll publish the new release on Thursday, together with #10. Until then you can keep using this approach with an absolute path.
I wonโt lie, I donโt fully understand everything you just mentioned. ๐ But, yes! Totally works! ๐ ๐ ๐