Skip to content

Instantly share code, notes, and snippets.

@rexxars
Last active November 10, 2017 17:45
Show Gist options
  • Save rexxars/6168e5d41f770e929d900e88e5f743b4 to your computer and use it in GitHub Desktop.
Save rexxars/6168e5d41f770e929d900e88e5f743b4 to your computer and use it in GitHub Desktop.
Webpack test
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')
);
{
"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"
}
}
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