fix (build): fix webpack crap

This commit is contained in:
Mickael KERJEAN
2018-06-05 16:46:12 +10:00
parent 08a6fddcf0
commit ace4297620
5 changed files with 15 additions and 30 deletions

View File

@ -12,7 +12,7 @@ RUN apk add --no-cache git && \
apk del .build-deps && \
npm install && \
# PRODUCTION BUILD
npm run build && \
NODE_ENV=production npm run build && \
npm prune --production
EXPOSE 8334

View File

@ -14,10 +14,3 @@ services:
container_name: nuage_transcode
image: machines/nuage_transcode
restart: always
reverse_proxy:
container_name: nuage_reverse_proxy
image: machines/nuage_reverse_proxy
restart: always
ports:
- "8888:80"

View File

@ -6,7 +6,7 @@
"main": "server/index.js",
"scripts": {
"dev": "webpack --watch",
"build": "NODE_ENV=production webpack -p",
"build": "webpack",
"image": "docker build -t nuage -f ./docker/Dockerfile .",
"publish": "docker tag nuage machines/nuage && docker push machines/nuage",
"clean": "rm -rf server/public/js server/public/*.html || true",
@ -36,6 +36,7 @@
"ssh2-sftp-client": "^1.1.0",
"stream-to-string": "^1.1.0",
"string-to-stream": "^1.1.0",
"uglifyjs-webpack-plugin": "^1.2.5",
"webdav-fs": "^1.10.1",
"winston": "^2.3.1",
"winston-couchdb": "^0.6.3"

View File

@ -1,4 +1,4 @@
var path = require('path');
const path = require('path');
module.exports.getMimeType = function(file){
let ext = path.extname(file).replace(/^\./, '').toLowerCase();
@ -231,6 +231,6 @@ const db = {
"docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation"
}
};
module.exports.mime = db;

View File

@ -2,6 +2,7 @@ const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
let config = {
entry: {
@ -47,29 +48,19 @@ let config = {
new HtmlWebpackPlugin({
template: path.join(__dirname, 'client', 'index.html'),
inject:true
})
}),
//new BundleAnalyzerPlugin()
]
};
if(process.env.NODE_ENV === 'production'){
config.plugins.push(new webpack.optimize.UglifyJsPlugin());
config.plugins.push(new UglifyJSPlugin({
sourceMap: false
}));
}else{
config.devtool = '#inline-source-map';
config.devServer = {
contentBase: path.join(__dirname, "server", "public"),
disableHostCheck: true,
hot: true,
historyApiFallback: {
index: 'index.html'
},
proxy: {
'/api': {
target: 'http://127.0.0.1:3000'
}
}
};
}
module.exports = config;