Browse Source

fix webpack for angular and autodeploy

pull/146/head
Davide Bragagnolo 7 years ago
parent
commit
5cbb83503a
4 changed files with 42 additions and 27 deletions
  1. +3
    -4
      package.json
  2. +12
    -0
      server.js
  3. +4
    -0
      webpack/plugins/copyPlugin.js
  4. +23
    -23
      webpack/plugins/internal.js

+ 3
- 4
package.json View File

@ -4,8 +4,9 @@
"private": true,
"description": "HTML Admin Template",
"scripts": {
"start": "webpack-dev-server",
"start": "npm run build && node server.js",
"dev": "webpack-dashboard -t 'Project' -- webpack-dev-server",
"quickdev": "webpack-dev-server",
"clean": "shx rm -rf ./build",
"build": "npm run clean && cross-env NODE_ENV=\"production\" webpack",
"preview": "cross-env NODE_ENV=\"production\" webpack-dev-server",
@ -13,9 +14,6 @@
"lint:scss": "stylelint ./src/**/*.scss --syntax scss",
"lint": "npm run lint:js && npm run lint:scss"
},
"devDependencies": {
"html-loader": "^0.5.5"
},
"dependencies": {
"angular": "^1.6.4",
"angular-cookies": "^1.6.4",
@ -45,6 +43,7 @@
"eslint": "^4.9.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "2.7.0",
"express": "^4.16.4",
"extract-text-webpack-plugin": "^3.0.1",
"file-loader": "^1.1.5",
"fullcalendar": "^3.6.2",


+ 12
- 0
server.js View File

@ -0,0 +1,12 @@
const express = require('express');
const app = express();
app.use(express.static('public'));
// start the server with the build folder.
app.use('/', express.static(__dirname + '/build'));
const server = app.listen(process.env.PORT || 3000, function () {
console.log('Server started at http://localhost:%s', server.address().port);
});

+ 4
- 0
webpack/plugins/copyPlugin.js View File

@ -8,4 +8,8 @@ module.exports = new CopyWebpackPlugin([
from : path.join(manifest.paths.src, 'assets/static'),
to : path.join(manifest.paths.build, 'assets/static'),
},
{
from : path.join(manifest.paths.src, 'assets/scripts'),
to : path.join(manifest.paths.build, 'assets/scripts'),
},
]);

+ 23
- 23
webpack/plugins/internal.js View File

@ -56,29 +56,29 @@ plugins.push(
// @Merging Production Plugins
// ---------------------------
if (manifest.IS_PRODUCTION) {
plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
comparisons : true,
conditionals : true,
dead_code : true,
drop_debugger : true,
evaluate : true,
if_return : true,
join_vars : true,
screw_ie8 : true,
sequences : true,
unused : true,
warnings : false,
},
output: {
comments: false,
},
})
);
}
// if (manifest.IS_PRODUCTION) {
// plugins.push(
// new webpack.optimize.UglifyJsPlugin({
// compress: {
// comparisons : true,
// conditionals : true,
// dead_code : true,
// drop_debugger : true,
// evaluate : true,
// if_return : true,
// join_vars : true,
// screw_ie8 : true,
// sequences : true,
// unused : true,
// warnings : false,
// },
// output: {
// comments: false,
// },
// })
// );
// }
// ----------------------------


Loading…
Cancel
Save