I'm trying to create an NPM module with great pain: react-smallgrid
import React from 'react';
import _ from 'lodash';
export default class SmallGrid extends React.Component{
Compiled with:
browserify: {
options: {
transform: [
['babelify', {
presets: ['react', 'es2015']
}]
]
},
jsx: {
files: {
'./dist/js/smallgrid.js': [
'./src/smallgrid.jsx',
]
}
},
When I import the js file in another project/jsx and try to browserify that, it gives the error:
Error: Cannot find module './ReactMount' from '/Users/me/code/react-smallgrid/dist/js'
I thought it's already compiled for use? I don't understand this.
Meanwhile
I've tried building it with webpack, which gives the following output:
> webpack -p
Hash: 00fd87c95d39230bd485
Version: webpack 1.12.11
Time: 14002ms
Asset Size Chunks Chunk Names
smallgrid.js 248 kB 0 [emitted] smallgrid
+ 160 hidden modules
WARNING in smallgrid.js from UglifyJs
Condition always true [./~/react/lib/ReactMount.js:764,0]
Condition always true [./~/react/lib/findDOMNode.js:46,0]
Condition always true [./~/react/lib/instantiateReactComponent.js:80,0]
Still does not work.
importtheSmallGridplease?import SmallGrid from 'react-smallgrid';. It might be easier tonpm run kitchen_sinkon the webpack branch where I'm trying to replicate the problem using an example file