-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Can't find css-loader #2936
Comments
just apply those changes to your
and of course remove |
Also getting this with |
Removing node-sass and reinstalling sass worked for me. |
Is this the same issue as #1931? I'm getting this same error on a project without any Sass; only one Stylus file so I doubt |
Having the same issue here. I couldn't figure out what is going on nor make it work. Here the full error:
|
I'm seeing this too. Happens during HMR, console message is in the browser. why would it be trying to resolve that path in the browser? or is this just an error being bubbled up over the websocket connection... Attempting a rollback of the parcel package to see if I can get a working version. |
Please let us know if you solve this issue.
I still couldn't find a solution..
Thanks
…On Sat 1 Jun 2019, 05:06 Ash Guy, ***@***.***> wrote:
I'm seeing this too. Happens during HMR, console message is in the
browser. why would it be trying to resolve that path in the browser? or is
this just an error being bubbled up over the websocket connection...
Attempting a rollback of the parcel package to see if I can get a working
version.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2936?email_source=notifications&email_token=AAE5CHYBC4DDJIEQJ5UULY3PYHRTFA5CNFSM4HG7XLC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWWXLTI#issuecomment-497907149>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAE5CH4NX3A7VMDMV5SF6F3PYHRTFANCNFSM4HG7XLCQ>
.
|
For the people who are struggling with this, just run parcel without hmr 'parcel run FILENAME - -no-hmr'. However, by doing this you won't be able to hook into the hot module as it is going to be disabled. |
I will try. Thanks for your help.
…On Sat 1 Jun 2019, 11:47 Liviu Dobrea, ***@***.***> wrote:
For the people who are struggling with this, just run parcel without hmr
'parcel run FILENAME - -no-hmr'.
However, by doing this you won't be able to hook into the hot module as it
is going to be disabled.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2936?email_source=notifications&email_token=AAE5CH52SYEATTB7GOYUJR3PYJARXA5CNFSM4HG7XLC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWW47PI#issuecomment-497930173>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAE5CH7V5AXAXMCGWLX7ENTPYJARXANCNFSM4HG7XLCQ>
.
|
@liviudobrea Wouldn't that prevent automatic reloading on file-save (aka HMR), thereby negating one of the main features of Parcel.js with running At that point, you may as well just run |
Indeed it would disable Hmr, as I have mentioned. You have therefore multiple ways going forward, one of them is that of letting go of hmr and manually refreshing. Another better one would be debugging the parcel builders and trying to figure out a fix for the issue, or setting up a webpack boilerplate with manual hmr integration of your choice. Best of luck. |
@liviudobrea Just wanted to clarify not all of those are ways forward.
That is sacrificing one of the major features of Parcel.js. It's #2 on the Features page. I don't see that as an acceptable way forward.
Again, suggesting to use a completely different alternative to Parcel.js is not a way forward. That's self-explanatory.
Hence, we arrive at #2936 in order to debug this issue and address it at the root. Which is why we're all here. |
The only way to debug this issue is with some kind of reproduction. |
I'm running into this issue. Feel free to clone this and give it a shot. JS reloads fine, CSS does not. Console log - Tried poking for a while to no avail. Hopefully this repo helps. |
With that repo, changing the JS code throws "Uncaught SyntaxError: Unexpected end of input" (because it reloades too quickly before it's completely bundled?). That works again when Changing the CSS does log that error Using parcel's integrated dev server works as well. This happens because the HMR runtime is packaged into a seperate JS file that isn't being loaded because Parcel is being used to bundle only specific files (e.g. |
I dug into this today and found that the following changes make css hot reloading work again, at least for the sample repo posted by @billcolumbia above. I don't know the project well enough to describe my change to Hopefully this can lead someone in the the direction of a proper fix, because this is definitely a hack ;) index 819700f..d00c9bf 100644
--- packages/core/parcel-bundler/src/builtins/css-loader.js
+++ packages/core/parcel-bundler/src/builtins/css-loader.js
@@ -18,9 +18,9 @@ function reloadCSS() {
cssTimeout = setTimeout(function () {
var links = document.querySelectorAll('link[rel="stylesheet"]');
for (var i = 0; i < links.length; i++) {
- if (bundle.getBaseURL(links[i].href) === bundle.getBundleURL()) {
+ //if (bundle.getBaseURL(links[i].href) === bundle.getBundleURL()) {
updateLink(links[i]);
- }
+ // }
}
cssTimeout = null;
diff --git packages/core/parcel-bundler/src/packagers/JSPackager.js packages/core/parcel-bundler/src/packagers/JSPackager.js
index a07ff3b..c260b7b 100644
--- packages/core/parcel-bundler/src/packagers/JSPackager.js
+++ packages/core/parcel-bundler/src/packagers/JSPackager.js
@@ -218,6 +218,12 @@ class JSPackager extends Packager {
entry.push(asset.id);
}
+ let cssLoaderAsset = await this.bundler.getAsset(
+ require.resolve('../builtins/css-loader')
+ );
+ await this.addAssetToBundle(cssLoaderAsset);
+ entry.push(cssLoaderAsset.id);
+
if (await this.writeBundleLoaders()) {
entry.push(0);
} |
Even I had the same issue, first I installed parcel globally
Here is the simple solution: just remove My package.json:
|
Removing .cache and dist folder fixes the problem for me (It happens really rare and i always forgot what should i do :D) The error i was having is this
|
@syed-haroon and @Stradivario: With your fix applied (i.e., once you've deleted those folders), is the issue resolved permanently or does it still return occasionally? |
Removing .cache has no effect for me. I don't have a dist folder. Also, @Stradivario's reported error is not the same as the one I'm experiencing (reported by @bichotll, @billcolumbia). Seems like there are 2 separate problems here. |
@Bauerpauer Could you please post your code? |
I posted a repo above in this thread to reproduce the issue
… On Jun 30, 2019, at 4:08 AM, Niklas Mischkulnig ***@***.***> wrote:
@Bauerpauer Could you please share a reproduction?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Did not get the error so far. It's been like a week now. |
I also run into this error. Removing dist or .cache folder does not solve it. With linking to the other pages, including also those CSS files, I ran into that error. Running serve with a subpage as endpoint, then the error does not appear. But if I navigate to another endpoint page it appears too. Notice: if starting a page - which is not linked with the other pages, there is no error. So embedding direct links causes those error - when navigate to another endpoint, which is "connected" to each other. |
I have had the same problem and found the origin of it. |
There seems to be a bug in Parcel though preventing it from working (parcel-bundler/parcel#2936).
same issue here~ |
It produces this issue parcel-bundler/parcel#2936
I managed to get this to work as well; Still not ideal, but better than working on a single file at the time. |
I am getting this as well. Does anyone know if this problem is fixed in v2? |
I have this issue too. the solution from @Trollhag doesn't work for me. Is this gonna be fixed soon ? |
Sorry to pile on, but the issue still happnes. |
Have this issue with style tags |
Same issue here with an Scss file. I'm using parcel 1.12.4 and serve the files with the custom express server (a hard requirement for this project) which serves the dist folder as well as doing some API handling. HTML and JS HMR works, CSS is throwing the same css-loader error. Following @Bauerpauer's idea I've patched parcel-bundler (using The two differences to my approach:
diff --git a/node_modules/parcel-bundler/src/packagers/JSPackager.js b/node_modules/parcel-bundler/src/packagers/JSPackager.js
index a07ff3b..8adcc67 100644
--- a/node_modules/parcel-bundler/src/packagers/JSPackager.js
+++ b/node_modules/parcel-bundler/src/packagers/JSPackager.js
@@ -216,6 +216,12 @@ class JSPackager extends Packager {
);
await this.addAssetToBundle(asset);
entry.push(asset.id);
+
+ let cssLoaderAsset = await this.bundler.getAsset(
+ require.resolve('../builtins/css-loader')
+ );
+ await this.addAssetToBundle(cssLoaderAsset);
+ entry.push(cssLoaderAsset.id);
}
if (await this.writeBundleLoaders()) { |
Thanks @emirotin! I didn't know about |
What did you run into? |
More problems, by the sounds of it... |
@mischnic Sorry, I don't remember, it's been a few months and was in a rush, had to switch back to old version. If I run into 'em again I'll let ya know. |
what is the status on this? |
Your best bet to quickly fix it now is to use my patch and https://www.npmjs.com/package/patch-package |
Thanks, it works! Appreciate taking your time looking into this and posting the solution. |
I had this issue and solved it by importing the css/scss file into a javascript file. Inside index.js |
Is this issue planned to be fixed, or is it being left to be addressed in version 2? (if it's fixable there) |
I run into this error with any of the new CSS functions (e.g. min() max() clamp()) used in plain .css files. I've seen different issues (but caused by a similar situation) in other packages where these (new) native functions don't mix with existing SASS functions. I'm sorry I can't figure out if that's the actual case here, but this might help. |
the issue is still here :sad: |
Hi, By the way, many people above mention using parcel 1.12. When I installed it, I got version 1.3.1. Is that some unstable version? |
@PanuGr I also have this problem–currently running version |
I have the same problem. Caused by
When I comment this line out, the error disappears and executes the following JS code.
Solves the error in the meantime. |
I am getting this issue with 1.12.4 too. My build script is a simple |
Same issue here, Parcel 1.12.4; unfortunatley @emirotin's patch does not work for me :( Might try to update to Parcel 2 but that will need a good chunk of a refactor to do so |
Hello guys, i don't how, but i solved this problem
When u start 7 event npm must install : And u package.json should become this screen I hope I helped you in solving your problem. |
Configuration was working then all of a sudden stopped. I've tried removing my
node_modules
and re-installing but no dice.The text was updated successfully, but these errors were encountered: