This paper introduces a method of

webpack package node.js back-end project, for everyone to share, as follows:

NPM install --save-dev webpack babel-loader babel-preset-es2015 babel-preset-stage-0


pre>'use strict' configuration


< const; webpack = require; externals = let ('webpack') _externals (module.exports); = {entry:}'./app.js' {app:, target:,'node', output: {path:'./build'} resolve: {filename:,'[name].js', extensions: ['', '.js'] externals: externals, node:}, {console: true, global: true, process: true, Buffer: true, __filename: true, __dirname: true, setImmediate: true module: {loaders:}, {[test: /.js$/, loader:'babel', query: {presets: ['es2015','stage-0']]}}}, exclude: /node_modules/, plugins: new (webpack.optimize.UglifyJsPlugin)} [] function; _externals (let) {manifest = require ('./package.json'); let dependencies = manifest.dependencies; let = externals {}; for (let P in dependencies) {externals[p]}' ='commonjs + p; return externals;


project directory +cont All +models +routes +service +test +util roller -app.js -config.json -gulpfile.js -models.js -package.json -pm2.json -webpack.config.js


is this, want to help everyone to learn, I hope you will support a script.

This paper fixed link: | Script Home | +Copy Link

Article reprint please specify:Webpack methods for packaging node.js back end projects | Script Home

You may also be interested in these articles!