Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Commit

Permalink
Add production build
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Jan 2, 2018
1 parent b5195e3 commit 558d924
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
8 changes: 6 additions & 2 deletions package.json
Expand Up @@ -5,7 +5,8 @@
"main": "spoken-content.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
"dev": "webpack --watch --config webpack.dev.js",
"build": "webpack --config webpack.prod.js"
},
"repository": {
"type": "git",
Expand All @@ -23,12 +24,15 @@
"babel-loader": "^7.1.2",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"clean-webpack-plugin": "^0.1.17",
"eslint": "^4.13.1",
"eslint-config-wordpress": "^2.0.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.5.1",
"source-map-loader": "^0.2.3",
"webpack": "^3.10.0"
"uglifyjs-webpack-plugin": "^1.1.5",
"webpack": "^3.10.0",
"webpack-merge": "^4.1.1"
},
"dependencies": {
"babel-preset-es2015": "^6.24.1",
Expand Down
5 changes: 4 additions & 1 deletion webpack.config.js → webpack.common.js
@@ -1,6 +1,7 @@
/* eslint-env node */

const path = require( 'path' );
const CleanWebpackPlugin = require( 'clean-webpack-plugin' );

module.exports = {
entry: './src/index.js',
Expand All @@ -10,7 +11,9 @@ module.exports = {
libraryTarget: 'window',
library: 'spokenWord',
},
devtool: 'source-map',
plugins: [
new CleanWebpackPlugin( [ 'dist' ] ),
],
module: {
rules: [
{
Expand Down
8 changes: 8 additions & 0 deletions webpack.dev.js
@@ -0,0 +1,8 @@
/* eslint-env node */

const merge = require( 'webpack-merge' );
const common = require( './webpack.common.js' );

module.exports = merge( common, {
devtool: 'inline-source-map'
} );
18 changes: 18 additions & 0 deletions webpack.prod.js
@@ -0,0 +1,18 @@
/* eslint-env node */

const webpack = require( 'webpack' );
const merge = require( 'webpack-merge' );
const common = require( './webpack.common.js' );
const UglifyJSPlugin = require( 'uglifyjs-webpack-plugin' );

module.exports = merge( common, {
devtool: 'source-map',
plugins: [
new UglifyJSPlugin( {
sourceMap: true,
} ),
new webpack.DefinePlugin( {
'process.env.NODE_ENV': JSON.stringify( 'production' ),
} ),
],
} );

0 comments on commit 558d924

Please sign in to comment.