.jsx extensions not working after upgrade
See original GitHub issueI recently upgraded Browserify from v10.2.4 to v12.0.1 and Babelify from v6.1.2 to v7.2.0
After the upgrade, when I run my build process I keep getting errors along the lines of:
[14:33:08] Error: Cannot find module './About' from '/Users/mherbst/Repos/data-validation-tool/src/client/components'
at /Users/mherbst/Repos/data-validation-tool/node_modules/browserify/node_modules/resolve/lib/async.js:55:21
at load (/Users/mherbst/Repos/data-validation-tool/node_modules/browserify/node_modules/resolve/lib/async.js:69:43)
at onex (/Users/mherbst/Repos/data-validation-tool/node_modules/browserify/node_modules/resolve/lib/async.js:92:31)
at /Users/mherbst/Repos/data-validation-tool/node_modules/browserify/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:95:15)
My file structure looks like:
Example src/client/components/About.jsx
module.exports = React.createClass({...});
Example src/client/components/index.js
module.exports = {
About: require('./About')
};
Example src/client/main.js
import {About, ...} from 'components';
...
...
...
This setup worked with the old version of Browserify. It breaks after the upgrade. Here is part of my build (Gulp pipeline): Part of src/gulpfile.js
var bundler = browserify({
entries: ['client/main.js'],
options: {
debug: true,
extensions: ['.jsx']
},
cache: {},
packageCache: {}
});
bundler.transform(babelify, { presets: ["es2015", "react"] });
When I change Example src/client/components/index.js to
module.exports = {
About: require('./About.jsx')
};
it works, which is what makes me think it’s a bug maybe. Is it, or did I miss something?
Issue Analytics
- State:
- Created 8 years ago
- Comments:6
Top Results From Across the Web
Why .js [file Extension] is not added while importing a ...
For my case, I used a community template for create-react-app called typescript-empty . For some reason, they neglected to keep in the ...
Read more >After updating to 1.4.0 the react-native extension no longer ...
Any idea if it is something to do with our extension that we can fix, or is updating to the insiders build the...
Read more >eslint-plugin-react - npm
Start using eslint-plugin-react in your project by running `npm i eslint-plugin-react`. ... Automatically fixable by the --fix CLI option.
Read more >Introducing JSX - React
It is called JSX, and it is a syntax extension to JavaScript. We recommend using it with React to describe what the UI...
Read more >Tutorial: Create a Node.js and React app in Visual Studio
Learn how to create a Node.js web application project from a Visual Studio template.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You overwrote
extensions
with[".jsx"]
. You need.js
in there too.@MatthewHerbst Ok, great!