###前提・実現したいこと
React、TypeScript、gulp、WebpackにてWebアプリを作っています。
ReactとReactDOMはnpmでインストールしてありWebpack→gulpを通してbundle.jsで一つの大きなJSファイルにしています。
いざファイルをローカルで表示させてみると、表示自体は問題ないのですがconsoleに以下の警告が表示されます。
Facebookの解説も読んで試してみたのですが消えてくれません。
どなたかご教授いただければと思います。
###発生している問題・エラーメッセージ
Warning: It looks like you're using a minified copy of the development build of React. When deploying React apps to production, make sure to use the production build which skips development warnings and is faster. See https://fb.me/react-minification for more details.
###該当のソースコード
// index.html <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"> <meta charset="utf-8"> <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="./css/main.min.css"> </head> <body> <article id="contents"></article> <script src="./js/bundle.js"></script> </body> </html>
// tsconfig.json { "compilerOptions": { "sourceMap": false, "noImplicitAny": true, "module": "commonjs", "target": "es5", "jsx": "react" }, "files": [ "./src/ts/app.tsx" ] }
// webpack.config.js var webpack = require('webpack'); module.exports = { entry: "./src/ts/app.tsx", output: { filename: "bundle.js" }, resolve: { extensions: ["", ".ts", ".webpack.js", ".tsx", ".js"] }, module: { loaders: [ { test: /\.tsx?$/, exclude: /node_modules/, loader: "ts-loader", } ] }, plugins: [ new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production'), }, }), new webpack.optimize.UglifyJsPlugin() ] };
// gulpfile.js Webpackの部分だけ抜粋 gulp.task('webpack', function() { var webpackConfig = require('./webpack.config.js'); return gulp.src([path.ts + '*.tsx']) .pipe(plumber()) .pipe(webpack(webpackConfig)) .pipe(gulp.dest(path.jsmin)); });
###試したこと
Facebookの解説通り、webpack.config.jsにwebpack.DefinePlugiとwebpack.optimize.UglifyJsPluginを追加してgulpでコンパイルしてみた
###補足情報(言語/FW/ツール等のバージョンなど)
Uglifyさせないと警告は出ないようです
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。