Skip to content

Commit

Permalink
Merge pull request #4 from drewhamlett/master
Browse files Browse the repository at this point in the history
Support extra plugins in config (such as UglifyJS)
  • Loading branch information
asfktz authored Jul 4, 2017
2 parents 1762e49 + f530359 commit f6632ab
Show file tree
Hide file tree
Showing 10 changed files with 2,298 additions and 5 deletions.
2 changes: 2 additions & 0 deletions examples/minification/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
13 changes: 13 additions & 0 deletions examples/minification/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AutoDllPlugin Basic Setup</title>
</head>
<body>
<div id="root"></div>

<script src="dist/vendor.dll.js"></script>
<script src="dist/app.bundle.js"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions examples/minification/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "basic",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"build": "webpack --config ./webpack.config.js"
},
"devDependencies": {
"autodll-webpack-plugin": "file:../../",
"webpack": "^3.0.0"
},
"dependencies": {
"moment": "^2.18.1",
"react": "^15.6.1",
"react-dom": "^15.6.1"
}
}
11 changes: 11 additions & 0 deletions examples/minification/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const moment = require('moment');
const React = require('react');
const ReactDOM = require('react-dom');
const createElement = React.createElement;

const Test = createElement('div', {}, [
createElement('h1', {}, [ 'AutoDllPlugin Basic Setup' ]),
createElement('p', {}, [ moment().format('LLLL') ])
]);

ReactDOM.render(Test, document.getElementById('root'))
31 changes: 31 additions & 0 deletions examples/minification/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const webpack = require('webpack');
const path = require('path');
const AutoDllPlugin = require('autodll-webpack-plugin');

module.exports = {
entry: {
app: './src/index.js'
},

output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
},

plugins: [
new AutoDllPlugin({
context: __dirname,
filename: '[name].dll.js',
entry: {
vendor: [
'react',
'react-dom',
'moment'
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin(),
]
})
]
};
Loading

0 comments on commit f6632ab

Please sign in to comment.