Closed verhovsky closed 4 years ago
You should be able to import redux-undo using ES6
modules perfectly fine. RunKit launches a Node environment which is why the imports still use require()
.
I just installed it in one of my projects using yarn v1.22.4 and it looked like it built it correctly.
Object.defineProperty(exports, "ActionTypes", {
enumerable: true,
get: function get() {
return _actions.ActionTypes;
}
});
Object.defineProperty(exports, "ActionCreators", {
enumerable: true,
get: function get() {
return _actions.ActionCreators;
}
});
// ...
var _actions = require("./actions");
I would try a simple uninstall/reinstall real quick. If the problem persists, please list your tooling versions and enviroment: yarn, webpack, operating system, etc.
Sorry, I pasted the contents of actions.js
, my index.js
looks like what you posted. I'm using
$ node --version
v12.14.0
$ yarn --version
1.22.4
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
I'm not using webpack or rollup or anything.
This is code running in the browser, Chrome 81
Is this because everyone is expected to be using a bundler? I made it work by copy and pasting cloning the repo into my code and doing import undoable from 'path/to/js/redux-undo/src/index.js
I
yarn add redux-undo
'd, version^1.0.1
and tried to import itI get this error:
If I look at that file, it looks like this
Is something wrong with my setup or are you building the releases wrong? If I go to https://www.npmjs.com/package/redux-undo and click Try on RunKit it's imported using
require('redux-undo')
and the file also doesn't look like an ES6 module https://npm.runkit.com/redux-undo/es/actions.js?t=1586799334448