Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in Webpack make the suggested configurations throw an error (Adding imports-loader exports-loader) #4

Closed
diego-caceres opened this issue Feb 20, 2017 · 3 comments

Comments

@diego-caceres
Copy link

When we are adding Fetch and imports-loader and exports-loader to the project, the tutorial suggests to add the following configuration to 'webpack.config.js' :
plugins: [ new webpack.ProvidePlugin({ 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch' }) ]
But if you try to start the project you get an error. The problem is that WebPack's new version doesn't support to omit the '-loader' suffix.

The working configuration for me ended up like this:
plugins: [ new webpack.ProvidePlugin({ 'fetch': 'imports-loader?this=>global!exports-loader?global.fetch!whatwg-fetch' }) ]

@rwieruch
Copy link
Owner

9e1e057 this should do the effect. Thanks again @diego-caceres for your help! 👍

@rwieruch
Copy link
Owner

rwieruch commented Feb 21, 2017

@diego-caceres could you copy paste your package.json here? I would love to update the dependencies in the article :)

"devDependencies": { "babel-core": "^6.9.1", "babel-loader": "^6.2.4", "babel-preset-es2015": "^6.9.0", "babel-preset-react": "^6.5.0", "babel-preset-stage-2": "^6.5.0", "chai": "^3.5.0", "enzyme": "^2.3.0", "exports-loader": "^0.6.3", "imports-loader": "^0.6.5", "jsdom": "^9.2.1", "mocha": "^2.5.3", "react-addons-test-utils": "^15.1.0", "react-hot-loader": "^1.3.0", "webpack": "^1.13.1", "webpack-dev-server": "^1.14.1" }, "dependencies": { "react": "^15.1.0", "react-dom": "^15.1.0", "react-redux": "^4.4.5", "react-router": "^2.4.1", "react-router-redux": "^4.0.5", "redux": "^3.5.2", "redux-logger": "^2.6.1", "redux-thunk": "^2.1.0", "soundcloud": "^3.1.2", "whatwg-fetch": "^1.0.0" }

@diego-caceres
Copy link
Author

Here you are @rwieruch and thanks for your tutorial

{ "name": "sc-react-redux", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "start": "webpack-dev-server --progress --colors --hot --config ./webpack.config.js", "test": "mocha --compilers js:babel-core/register --require ./test/setup.js src/**/**/spec.js" }, "keywords": [], "author": "", "license": "ISC", "babel": { "presets": [ "es2015", "react", "stage-2" ] }, "devDependencies": { "babel-core": "^6.23.1", "babel-loader": "^6.3.2", "babel-preset-es2015": "^6.22.0", "babel-preset-react": "^6.23.0", "babel-preset-stage-2": "^6.22.0", "chai": "^3.5.0", "enzyme": "^2.7.1", "exports-loader": "^0.6.3", "imports-loader": "^0.7.0", "jsdom": "^9.11.0", "mocha": "^3.2.0", "react-addons-test-utils": "^15.4.2", "react-hot-loader": "^1.3.1", "webpack": "^2.2.1", "webpack-dev-server": "^2.4.1" }, "dependencies": { "react": "^15.4.2", "react-dom": "^15.4.2", "react-redux": "^5.0.2", "react-router": "^3.0.2", "react-router-redux": "^4.0.8", "redux": "^3.6.0", "redux-logger": "^2.8.1", "redux-thunk": "^2.2.0", "soundcloud": "^3.1.2", "whatwg-fetch": "^2.0.2" } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants