Reputation: 3599
I'm getting
Minified React error #130
when i import my react module to another application maybe the module build is wierd or not correct.
I referenced a similar question.
Uncaught Error: Minified React error #130
but i think i have it set up correctly.
src/Fetch
import React, {Component} from 'react';
import MyFetch from './MyFetch';
const Fetch = (props) => (
<div>
<form onSubmit={props.onSubmit}>
<input type="text" value={props.url} placeholder="enter a url" onChange={props.onChange}/>
</form>
<MyFetch url={props.url} method={props.method}/>
</div>
)
export default Fetch;
src/index.js
import Fetch from './Fetch';
export default Fetch
dist/index.js
import React from 'react';
import { render} from 'react-dom';
import Fetch from '../src'
const App = () => (
<Fetch />
);
render(<App />, document.getElementById("root"));
webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require("html-webpack-plugin");
const htmlWebpackPlugin = new HtmlWebpackPlugin({
template: path.join(__dirname, "dist/index.html"),
filename: "./index.html"
});
module.exports = {
entry: path.join(__dirname, "dist/index.js"),
output: {
path: path.join(__dirname, './'),
filename: 'index.js',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components|build)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/react'],
plugins:['@babel/plugin-proposal-class-properties']
}
}
}
]
},
plugins: [htmlWebpackPlugin],
resolve: {
extensions: [".js", ".jsx"]
},
devServer: {
port: 3001
}
};
Upvotes: 1
Views: 1368
Reputation: 3599
fixed it
plugins: [htmlWebpackPlugin,new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development')
}
})]
React - Minified exception occurred
Upvotes: 0