babel-plugin-transform-react-jsx-img-import icon indicating copy to clipboard operation
babel-plugin-transform-react-jsx-img-import copied to clipboard

Failed when turning off modules of ES2015 preset

Open liufei opened this issue 8 years ago • 5 comments

Thanks for the great plugin.

It does work with this config,

{
  "presets": [
    "es2015",
    "react"
  ],
  "plugins": [
    "react-hot-loader/babel",
    "transform-runtime",
    "transform-react-jsx-img-import"
  ]
}

but attribute of src is missing when turning off modules of ES2015 preset.

{
  "presets": [
    ["es2015", { "modules": false }],
    "react"
  ],
  "plugins": [
    "react-hot-loader/babel",
    "transform-runtime",
    "transform-react-jsx-img-import"
  ]
}

Below are versions of related packages:

"dependencies": {
  "react": "^15.3.2",
  "react-dom": "^15.3.2"
},
"devDependencies": {
  "babel-core": "^6.22.1",
  "babel-loader": "^6.2.10",
  "babel-plugin-transform-react-jsx-img-import": "^0.1.4",
  "babel-preset-es2015": "^6.18.0",
  "webpack": "^2.2.1",
  "webpack-dev-server": "^2.3.0"
}

How to solve this problem? Thanks.

liufei avatar Feb 11 '17 11:02 liufei

Bump, this plugin is great but is incompatible with Webpack 2 because of this

adrienharnay avatar Feb 16 '17 09:02 adrienharnay

Need support for {modules: false}.

rajatbarman avatar Mar 31 '17 11:03 rajatbarman

I agree. I really enjoy the simplicity that this brings but unfortunately this is a deal-breaker for me at this time. While it is not too difficult to import everything as necessary, being able to use <img src="@assets/images/small.jpg" /> (where @assets is a Webpack alias) is much better!

kendallroth avatar Jun 19 '17 04:06 kendallroth

@kendallroth, I'm going to give this a shot for dynamic imports for the time being. https://medium.com/@bogdan_plieshka/loading-static-and-dynamic-images-with-webpack-8a933e82cb1e

djfrsn avatar Jul 23 '17 01:07 djfrsn

Ran into this today. Is this package still maintained?

njgraf512 avatar Jul 28 '18 07:07 njgraf512