简体   繁体   中英

Using Redux in Meteor.js

I'm a newbie to Meteor.js and working on a project where I'm also using Redux so I added the kyutaekang:redux package. The problem is that I don't know how to import Redux to use it. I tried:

import { createStore } from 'redux'; ,

but when I start the app I get

[Error: Unable to fetch "redux". Only file URLs of the form file:/// allowed running in Node.] [Error: Unable to fetch "redux". Only file URLs of the form file:/// allowed running in Node.] .

Meteor does not yet support the ES2015 import out of the box (might be available in 1.3.0). Therefore, you will need a modern module bundler, as also described in the package's Readme file:

This assumes that you're using npm package manager with a module bundler like Webpack or Browserify to consume CommonJS modules.

You can take a look at this excellent example by Adam Brodzinski to get you started.

Edit :

After taking a closer look at the package, it does not seem to contain any code.

Nonetheless, my recommendation about Adam's repo (or his other repo , pointed in the comments) still remains as a nice, clean implementation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM