Last active
November 10, 2017 17:45
-
-
Save rexxars/6168e5d41f770e929d900e88e5f743b4 to your computer and use it in GitHub Desktop.
Webpack test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var React = require('react'); | |
var ReactDOM = require('react-dom'); | |
var ReactMarkdown = require('react-markdown'); | |
var input = '# This is a header\n\nAnd this is a paragraph'; | |
ReactDOM.render( | |
React.createElement(ReactMarkdown, {source: input}), | |
document.getElementById('container') | |
); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "wp-test", | |
"version": "1.0.0", | |
"main": "index.js", | |
"license": "MIT", | |
"scripts": { | |
"build": "webpack" | |
}, | |
"dependencies": { | |
"react": "^16.1.0", | |
"react-dom": "^16.1.0", | |
"react-markdown": "^2.5.0", | |
"uglifyjs-webpack-plugin": "^1.0.1", | |
"webpack": "^3.8.1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path') | |
var webpack = require('webpack') | |
var UglifyJSPlugin = require('uglifyjs-webpack-plugin'); | |
module.exports = { | |
entry: path.join(__dirname, 'index.js'), | |
output: { | |
filename: 'out.js' | |
}, | |
plugins: [ | |
new UglifyJSPlugin(), | |
new webpack.DefinePlugin({ | |
'process.env': { | |
'NODE_ENV': JSON.stringify('production') | |
} | |
}) | |
] | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment