FullHuman / purgecss-from-js

Extractor for js code
3 stars 3 forks source link

TypeError: prepack.prepack is not a function #2

Open wolfson-rebel opened 4 years ago

wolfson-rebel commented 4 years ago

First of all, thank you for this module. Could save the time as soon as we figure out the reason, why it crashes with the followin error:

TypeError: prepack.prepack is not a function at node_modules\purgecss-from-js\lib\purgejs.js:37:35

Please, advice ^_^

andysaman commented 4 years ago

Same issue here. Haven't found a workaround

kubal5003 commented 4 years ago

I have the same. I was looking into it and it looks like the contents of the package on npm are broken.

It's trying to execute prepack.prepack on content parameter of the extract function. It doesn't really make sense, so I'm assuming the problem is in publishing the latest codebase to npm.

kubal5003 commented 4 years ago

@alinaish or @Ffloriel would you be able to publish version 1.0.0 (the current codebase that is using esprima) to npm? I would hate to have to clone this and publish under different name without any significant contribution.

Ffloriel commented 4 years ago

Yep, prepack was used on the previous version. The current codebase was not published. Will do now, thanks for the ping

kubal5003 commented 4 years ago

Awesome, thank you!

jacobq commented 4 years ago

Does this work for anyone? I am still seeing an empty object for the default export/import.

npm info ``` $ npm info purgecss-from-js purgecss-from-js@1.0.0 | ISC | deps: 1 | versions: 2 Extractor for js files https://github.com/FullHuman/purgecss-from-js#readme keywords: purgecss-from, purgecss, selectors, css, js dist .tarball: https://registry.npmjs.org/purgecss-from-js/-/purgecss-from-js-1.0.0.tgz .shasum: fb075b596b79857860a69c00ab5087f2718b82dd .integrity: sha512-sTs61vO7gOl3irS8L0WmiadY+YAESMIfKqUd67SRdzVov2udevSEgMyPCgzfLbtxnGJxxeObR2FJ4CfPf2T6Cg== .unpackedSize: 140.9 kB dependencies: esprima: ^4.0.1 maintainers: - ffloriel - jsnanigans dist-tags: latest: 1.0.0 published a month ago by ffloriel ```
> var p = require('purgecss-from-js')
undefined
> p
{}
> typeof p
'object'
> Object.entries(p)
[]

When I go back to the old (v0.1.0) release I see a function like I expect:

> require('purgecss-from-js')
[Function: PurgeFromJs]
kubal5003 commented 4 years ago

Sorry, I'm just using a modified source version, so didn't have a chance to verify the new package.

jansesun commented 3 years ago

Does this work for anyone? I am still seeing an empty object for the default export/import.

npm info

> var p = require('purgecss-from-js')
undefined
> p
{}
> typeof p
'object'
> Object.entries(p)
[]

When I go back to the old (v0.1.0) release I see a function like I expect:

> require('purgecss-from-js')
[Function: PurgeFromJs]

I have the same problem