psl icon indicating copy to clipboard operation
psl copied to clipboard

Add support for ES6 browser import

Open laurentpellegrino opened this issue 7 years ago • 5 comments

It seems the library cannot be loaded with module imports on modern browsers.

The purpose would be to allow such imports since JavaScript imports are now available with all major browsers. Including an esm file or adapting existing files in the NPM package to have a default or another export would allow something like the following:

import psl from 'psl';

It would also be nice to be able to import only the desired function:

import {parse} from 'psl';

laurentpellegrino avatar Jul 19 '18 13:07 laurentpellegrino

On v1.8.0 I get this warning (in an Angular v10 project) :

WARNING in /home/.../Projects/...edit.component.ts depends on 'psl'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Is there any news on this?

mehmetgunacti avatar Jul 20 '20 10:07 mehmetgunacti

Issue has been pending for more than 2 years. Could we have this pretty basic fix merged ?

Standaa avatar Nov 03 '20 10:11 Standaa

Wait did @lpellegr actually open a pull request? I don't see one at least not an open one

EDIT: I found the PR https://github.com/lupomontero/psl/pull/42 Looks like @lpellegr waited about a year without any acknowledgement from repo maintainer

CubeOfCheese avatar Dec 14 '20 23:12 CubeOfCheese

I would really appreciate it since the bundle size is very big in my opinion.

andorfermichael avatar May 27 '21 09:05 andorfermichael

I suggest you looking at https://github.com/remusao/tldts. The library provides what psl does (and more) along with ESM support and active maintenance!

laurentpellegrino avatar May 29 '21 11:05 laurentpellegrino