importing js based libraries has always been tricky. With the latest rollup 0.50 things are not improving much.
It would be helpful to get an example in this seed on how to import lodash (or one of its methods, since most never use the entire library) and something like localforage.
Additionally, since we are talking about code that uses Typescript we will encounter references to this. With the setup as I have it now (see configs and package.json below) it get these warnings:
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
So rollup rewrites this to undefined, which does not seem as helpful?
Issues surrounding localforage look like this:
setItem' is not exported by 'node_modules/localforage/dist/localforage.js'
Issues with lodash.isempty like so:
Error: 'isEmpty' is not exported by node_modules/lodash.isempty/index.js
build.js (fixed up for rollup 0.50.x)
see the file here
The imports in the TS files look like this:
lodash
import { isEmpty } from 'lodash.isempty';
localforage
import * as localForage from 'localforage';
jwt-decode (even worse)
import * as jwt_decode_ from 'jwt-decode';
const jwt_decode = jwt_decode_;
Since there seems so much confusion and issues about these imports and bundling with rollup, it would be great to have that as part of such a seed project.
(i have spent too much time this morning trying to get this working)
importing js based libraries has always been tricky. With the latest rollup 0.50 things are not improving much.
It would be helpful to get an example in this seed on how to import lodash (or one of its methods, since most never use the entire library) and something like localforage.
Additionally, since we are talking about code that uses Typescript we will encounter references to
this
. With the setup as I have it now (see configs and package.json below) it get these warnings:So rollup rewrites this to undefined, which does not seem as helpful?
Issues surrounding localforage look like this:
Here is my setup:
package.json
build.js (fixed up for rollup 0.50.x) see the file here
The imports in the TS files look like this: lodash
import { isEmpty } from 'lodash.isempty';
localforageimport * as localForage from 'localforage';
jwt-decode (even worse)Since there seems so much confusion and issues about these imports and bundling with rollup, it would be great to have that as part of such a seed project.
(i have spent too much time this morning trying to get this working)