-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
getting Malformed unicode
error when importing png file with and without --preprocess='file-loader'
#118
Comments
Hi @tcoopman! Thanks for the report! In fact, the command-line shown is a little incorrect. Try this one: node_modules/.bin/fpack --development --preprocess='\.png$:file-loader' src/index.js One additional note on the node_modules/.bin/fpack --development --preprocess='\.png$:file-loader?publicPath=http://your.com/path/to/bundle/' src/index.js The reason for the change above is the fact that Alternatively, you may want to simplify the config using the node_modules/.bin/fpack --development --preprocess='\.png$:url-loader' src/index.js |
@zindel thanks, so now I've run into some more issues with the same command: > node_modules/.bin/fpack --development --preprocess='*.png$:file-loader' src/index.js
fpack: option `--preprocess': Pattern regexp parse error. Use POSIX syntax
Usage: fpack [OPTION]... [ENTRY POINTS]...
Try `fpack --help' for more information. I guess, this could receive some better error handling, but that was easy enough to fix: node_modules/.bin/fpack --development --preprocess='^*\.png$:file-loader' src/index.js
fpack: internal error, uncaught exception:
Not_found
Raised at file "src/core/lwt_pqueue.ml", line 78, characters 15-30
Called from file "src/core/lwt_pqueue.ml", line 86, characters 12-24
Re-raised at file "src/core/lwt.ml", line 3008, characters 20-29
Called from file "src/unix/lwt_main.ml", line 42, characters 8-18
Called from file "Fastpack/Fastpack.ml" (inlined), line 253, characters 2-52
Called from file "bin/fpack.ml", line 45, characters 12-45
Called from file "src/cmdliner_term.ml", line 27, characters 19-24
Called from file "src/cmdliner.ml", line 27, characters 27-34
Called from file "src/cmdliner.ml", line 106, characters 32-39 trying the url-loader results in different errors: node_modules/.bin/fpack --development --preprocess='\.png$:url-loader' src/index.js
Project Directory: /home/thomas/Workspace/playpass/argus/dashboard/assets
Mode: development
Call Stack:
'./logo_with_clock' from module: src/widgets/index.js
'./widgets/index' from module: src/dashboard.js
'./dashboard' from module: src/index.js
'./src/index.js' from module: $fp$main
Processing Module: src/widgets/logo_with_clock.js
Cannot find package path
Resolving '../../logo.png'. Base directory: '/home/thomas/Workspace/playpass/argus/dashboard/assets/src/widgets'
Resolving preprocessors 'url-loader'
Resolving preprocessor 'url-loader', base directory '/home/thomas/Workspace/playpass/argus/dashboard/assets/src/widgets'
Resolving 'url-loader'.
Mocked package?
...no.
Resolving 'url-loader' through "browser"
...not found.
Resolving package path
Path exists? '/home/thomas/Workspace/playpass/argus/dashboard/assets/src/widgets/node_modules/url-loader'
...no.
Path exists? '/home/thomas/Workspace/playpass/argus/dashboard/assets/src/node_modules/url-loader'
...no.
Path exists? '/home/thomas/Workspace/playpass/argus/dashboard/assets/node_modules/url-loader'
...no.
While processing dependency request:
'../../logo.png' from module: src/widgets/logo_with_clock.js but: ls /home/thomas/Workspace/playpass/argus/dashboard/assets/node_modules/url-loader
CHANGELOG.md dist/ LICENSE node_modules/ package.json README.md |
I think the issue may be connected with cache (I am working on a fix now, so perhaps in a few days it'll be gone). For the meantime please try: node_modules/.bin/fpack --no-cache --development --preprocess='\.png$:url-loader' src/index.js Or, alternatively, remove the The node_modules/.bin/fpack --development --preprocess='\.png$:file-loader' src/index.js |
It is indeed an issue with the cache, but now I get the same error for both: node_modules/.bin/fpack --no-cache --development --preprocess='\.png$:url-loader' src/index.js
fpack: internal error, uncaught exception:
Not_found
Raised at file "Fastpack/Fastpack.ml", line 223, characters 9-18
Called from file "src/core/lwt.ml", line 2068, characters 23-28
Re-raised at file "Fastpack/Fastpack.ml", line 228, characters 7-440
Re-raised at file "src/core/lwt.ml", line 3008, characters 20-29
Called from file "src/unix/lwt_main.ml", line 42, characters 8-18
Called from file "Fastpack/Fastpack.ml" (inlined), line 253, characters 2-52
Called from file "bin/fpack.ml", line 45, characters 12-45
Called from file "src/cmdliner_term.ml", line 27, characters 19-24
Called from file "src/cmdliner.ml", line 27, characters 27-34
Called from file "src/cmdliner.ml", line 106, characters 32-39 and
|
@tcoopman could you reproduce it using with the limited set of files? Like |
node_modules/.bin/fpack --version
0.5.4 (Commit: eaa749a) it was easy to reproduce. Running The logo is empty here |
Thank you for the reproducible repo! There is definitely an issue in how it looks for the node-connection code... I will add an issue for that. In the meantime if you still want to experiment - here is what may work for you (based on the repo above - notice the "loader-runner" in the package.json):
|
Hmm, with or without |
So, it didn't work for you as shown on the screenshot above? Weird... Try removing the There is no difference between |
Ok, some very interesting results (I've pushed the repo with some small changes): So a full log: $ rm -rf node_modules/
$ npm i
> [email protected] postinstall /home/thomas/Workspace/tmp/fastpack-issue/node_modules/fpack
> node postinstall.js
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
added 18 packages from 13 contributors and audited 31 packages in 1.37s
found 0 vulnerabilities
$ node_modules/.bin/fpack --preprocess='\\.png$:url-loader' --dev src/index.js
fpack: internal error, uncaught exception:
Not_found
Raised at file "src/core/lwt_pqueue.ml", line 78, characters 15-30
Called from file "src/core/lwt_pqueue.ml", line 86, characters 12-24
Re-raised at file "src/core/lwt.ml", line 3008, characters 20-29
Called from file "src/unix/lwt_main.ml", line 42, characters 8-18
Called from file "Fastpack/Fastpack.ml" (inlined), line 253, characters 2-52
Called from file "bin/fpack.ml", line 45, characters 12-45
Called from file "src/cmdliner_term.ml", line 27, characters 19-24
Called from file "src/cmdliner.ml", line 27, characters 27-34
Called from file "src/cmdliner.ml", line 106, characters 32-39
$ npm run fpack:url
> [email protected] fpack:url /home/thomas/Workspace/tmp/fastpack-issue
> fpack --preprocess='\.png$:url-loader' --dev src/index.js
Packed in 0.122s. Bundle: 2Kb. Modules: 3. Cache: used. Mode: development.
$ node_modules/.bin/fpack --preprocess='\\.png$:url-loader' --dev src/index.js
Packed in 0.016s. Bundle: 2Kb. Modules: 3. Cache: used. Mode: development.
$ node_modules/.bin/fpack --no-cache --preprocess='\\.png$:url-loader' --dev src/index.js
fpack: internal error, uncaught exception:
Not_found
Raised at file "Fastpack/Fastpack.ml", line 223, characters 9-18
Called from file "src/core/lwt.ml", line 2068, characters 23-28
Re-raised at file "Fastpack/Fastpack.ml", line 228, characters 7-440
Re-raised at file "src/core/lwt.ml", line 3008, characters 20-29
Called from file "src/unix/lwt_main.ml", line 42, characters 8-18
Called from file "Fastpack/Fastpack.ml" (inlined), line 253, characters 2-52
Called from file "bin/fpack.ml", line 45, characters 12-45
Called from file "src/cmdliner_term.ml", line 27, characters 19-24
Called from file "src/cmdliner.ml", line 27, characters 27-34
Called from file "src/cmdliner.ml", line 106, characters 32-39 So running it manually the first time doesn't work. Running it (same command!!) from package.json scripts works, if I run the command manually again, then it works (as long as I don't remove node_modules. Running it with Some more info: npm version 6.1.0 on linux. |
Thank you for narrowing it down! I think I know what the issue is. In fact it is a combination of two problems:
Both are reproducible quite well using the script above, so thank you again for a great testing :) |
One week later, but still :) Could you please give it a try installing the latest |
It seems to be better, but I still got the error a few times, I don't know how to reproduce it yet though. Going to try to find out. |
Having a bad pattern in the loader can make it fail with the same error: node_modules/.bin/fpack --dev src/index.js --preprocess='^\\.png$:url-loader'
Parse error
/home/thomas/Workspace/playpass/argus/dashboard/assets/logo.png
--------------------
Malformed unicode at (0:0) - (0:0):
1 │ PNG This is probably a different bug, but it looks like the error message should at least be improved for this. |
This is the error message
To be sure it wasn't my image I also tried this one: http://pngimg.com/uploads/simpsons/simpsons_PNG96.png, same error.
The text was updated successfully, but these errors were encountered: