pace
pace copied to clipboard
Module not found: Error: Cannot resolve module 'pace'
Bug when I use it with webpack. Could you fix here https://www.npmjs.com/package/pace-progress ?
+1
I'm running into this issue as well. Both import pace from 'pace-progress';
and require('pace-progress');
cause the build to fail.
Have you guys find a solution for this?
+1
+1 same for me:
Can't resolve 'pace'
+1
I managed to get around this by running npm install pace --save
ie. installing pace explicitly into the root of the node_modules
folder
+1
The workaround proposed by @Jbarget works for me also. But I prefer a solution from the module authors
of course, at the moment if you use my workaround you'll have 2 copies of pace
installed on the project which is unnecessary (one in the root and the other nested within pace-progress
. hoping it will only be temporary
@Jbarget Yeah, I also hope it will be temporary. By the way, isn't there a way to make 'pace' resolve to the nested pace module? Like using Webpack's alias or something like that.
good point! im working on other functionality at the moment but will definitely revisit this
@Jbarget I will also give it a look when I had a little more time
The problem is that the AMD define
in pace.js is incorrect:
define(['pace'], function() {
return Pace;
});
(This defines a pace
as a dependency, and pace
on npm is an unrelated CLI progress bar package that this project doesn't depend on.)
Correct define
would be this (naming the module in the define call should be avoided):
define(function() {
return Pace;
});
To get around this until it's fixed, just disable amd for pace-progress:
{ test: require.resolve("pace-progress"), loader: "imports?define=>false" }
this requires the imports loader for webpack:
npm install imports-loader --save-dev
After that, you can just import it as usual:
import Pace from 'pace-progress';
Sorry for not being involved in the discussion, but I just got this error today and it seems an easy enough fix
- update pace.coffee
-
npm install && grunt
- git push
Hopefully I've not missed anything, sorry if I did, I'd love to know what so I don't make the mistake again.
Anyone using https://github.com/bigcommerce/stencil, I'll be pushing a patch to that too
bump please
I am still getting the issue in stencil
Stencil has updated. Hubspot AFAIK has done nothing so you'll have to manually patch hubspot pace from my repo ATM
How can this still not be fixed? :( @yfilali's workaround works great thought.
@yfilali this configuration is not valid for webpack 2.0. If you use 2.0, pls write full loader name like this:
{
test: require.resolve("pace-progress"),
loader: "imports-loader?define=>false"
}
A quick fix is to fulfil it temporarily with:
npm install --save-dev github:HubSpot/pace#v1.0.2
anyone managed to get this working in webpack 2?
my code;
require('pace-progress');
{
test: require.resolve("pace-progress"),
loader: "imports-loader?define=>false"
}
with webpack2 just need
resolve: {
alias: {
pace: 'pace-progress'
}
}
Unfortunately this is still an issue, but @yozman fix works in webpack 3 as well. Is there a bigger fork we can point to, or can we discuss a 'pace' organization and get a few people on board ?
Pace is such an amazing library could you please fix the loading part via Import?
Thanks in advance.
-Greg
No hero willing to save the world here !
:(
In my symfony webpack i use:
require('imports-loader?define=>false?pace-js');
Incredible that this hasn't been solved yet. It's just a one liner and would resolve so much pain!
As @yfilali states just replace the following here:
define(['pace'], function() {
return Pace;
});
with
define(function() {
return Pace;
});
and the world is a happier place :)
the @yozman solution works well for me with webpack ^3.11 but i ended using this solution :
module: {
rules: [
{
test: require.resolve("pace-progress"),
loader: "imports-loader?define=>false"
}
]
}
thanks for publishing this as pace-js-amd-fix npm module
thankyou @chebaby for the fix 👍 it worked for my situation (kotlin and webpack)