bitjs icon indicating copy to clipboard operation
bitjs copied to clipboard

Angular 9 + "no loaders are configured"

Open SamPool1 opened this issue 5 years ago • 2 comments

Hi there,

Was hoping you could help me out. I'm trying to use your bitjs in an angular 9 application and I am running into this problem:

./node_modules/@codedread/bitjs/image/webp-shim/webp-shim.js 9:18
Module parse failed: Unexpected token (9:18)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> const url = import.meta.url;
| if (!url.endsWith('/webp-shim.js')) {
|   throw 'webp-shim must be loaded as webp-shim.js';

I've made sure all of the JS files are imported properly, and followed your simple example but can't seem to figure out what i'm doing wrong.

Thanks for your help

EDIT: I double checked and I am receiving the file from the api as a type arraybuffer.

SamPool1 avatar Aug 29 '20 01:08 SamPool1

Hi there - this is a new issue to me.

Browser support for import.meta.url was added recently [1], but support for it in webpack was only added in version 5[2]. Can you manually update to webpack 5+ ?

On the other hand, support for WebP in Safari is coming along now [3], so maybe you don't even need this feature (loading WebP - is that something you need to worry about)?

[1] https://caniuse.com/#search=import.meta [2] https://github.com/webpack/webpack/issues/6719 [3] https://caniuse.com/#search=webp

codedread avatar Aug 29 '20 06:08 codedread

Hey! Apologies for the delayed response. I think the issue might have to do with Angular 10 not using Webpack (not sure what version they stopped using it, but its been a bit from what I understand). Angular is also throwing a fit on the importScript statements. I'm going to keep messing around with it, and i'll keep you updated if I'm able to get it integrated and how.

SamPool1 avatar Aug 31 '20 15:08 SamPool1

Hi there @SamPool1 - is this issue still valid? Any idea?

codedread avatar Mar 21 '23 18:03 codedread

Closing as obsolete. Pls feel free to re-open if you have more info to share.

codedread avatar Jan 25 '24 17:01 codedread