Skip to content

Commit

Permalink
Add production build target. HFP-987
Browse files Browse the repository at this point in the history
  • Loading branch information
tajakobsen committed Apr 24, 2017
1 parent 2fe25af commit e4b1d5d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -8,7 +8,7 @@ Grab all the modules:
npm install
```

Build project:
Build project for production:

```bash
npm run build
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -4,7 +4,7 @@
"description": "H5P content type for recording audio",
"scripts": {
"test": "ava",
"build": "webpack",
"build": "cross-env NODE_ENV='production' webpack -p",
"watch": "webpack --watch"
},
"repository": {
Expand All @@ -21,6 +21,7 @@
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-preset-latest": "^6.22.0",
"cross-env": "^4.0.0",
"css-loader": "^0.26.2",
"extract-text-webpack-plugin": "^2.0.0",
"node-sass": "^4.5.2",
Expand Down
15 changes: 12 additions & 3 deletions webpack.config.js
@@ -1,4 +1,5 @@
var path = require('path');
const path = require('path');
const webpack = require('webpack');

const config = {
entry: "./src/entries/dist.js",
Expand All @@ -10,7 +11,7 @@ const config = {
},
resolve: {
alias: {
vue: 'vue/dist/vue.js'
'vue$': 'vue/dist/vue.esm.js'
},
modules: [
path.resolve('./src'),
Expand Down Expand Up @@ -43,7 +44,15 @@ const config = {
loader: 'url-loader?limit=10000'
} // inline base64 URLs for <=10k images, direct URLs for the rest
]
}
},

plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}
}),
]
};

module.exports = config;

0 comments on commit e4b1d5d

Please sign in to comment.