Snipper03
Snipper03

Reputation: 1534

Rails/Webpacker is not working

I have a Rails/React project. It's using Rails/webpack 3.3.0. To precompile react code, I executed:

rails assets:precompile RAILS_ENV=development

But I am getting this error:

[Webpacker] Compilation failed:

(node:47256) DeprecationWarning: Tapable.apply is deprecated.

Call apply on the plugin directly instead (node:47256) DeprecationWarning:

Tapable.plugin is deprecated. Use new API on .hooks instead

TypeError: dep.getResourceIdentifier is not a function

Is this something you faced before? Would you like to help me to fix thsi problem?

Here is my package.json

{
  "dependencies": {
    "@rails/webpacker": "3.3.0",
    "babel-core": "6",
    "babel-loader": "^7.1.4",
    "babel-preset-react": "^6.24.1",
    "caniuse-lite": "^1.0.3000697",
    "classnames": "^2.2.5",
    "coffee-loader": "^0.9.0",
    "coffeescript": "^2.2.2",
    "debounce": "^1.1.0",
    "es6-shim": "^0.35.3",
    "extract-text-webpack-plugin": "^4.0.0-beta.0",
    "mobile-detect": "^1.4.1",
    "prop-types": "^15.6.1",
    "react": "16.0.0",
    "react-addons-css-transition-group": "^16.0.0-alpha.3",
    "react-addons-update": "^15.6.2",
    "react-bootstrap": "^0.32.1",
    "react-dom": "^16.2.0",
    "react-dom-factories": "^1.0.2",
    "react_ujs": "^2.4.4",
    "uglifyjs-webpack-plugin": "^1.2.5",
    "webpack": "4.0.0"
  },
  "devDependencies": {
    "webpack-cli": "^2.0.15",
    "webpack-dev-server": "^3.1.0"
  },
  "license": "UNLICENSED",
  "private": true
}

Upvotes: 2

Views: 1781

Answers (1)

Petercopter
Petercopter

Reputation: 1257

The version of Webpacker you are using isn't compatible with Webpack 4.

However, it looks like support is close, Webpack 4.x support has been merged: https://github.com/rails/webpacker/pull/1316

And there's a Webpacker 4.x preview release: https://rubygems.org/gems/webpacker

So I believe you want to use Webpack 3.x for the time being, or go bleeding edge and try the prerelease.

With that said, I'm going to give the prerelease a go, I've been waiting for Webpack 4.x support!

Upvotes: 1

Related Questions