Last active
April 11, 2017 13:01
-
-
Save VovanSuper/8edf6ee6583e0b79879ae47d7486ff5e to your computer and use it in GitHub Desktop.
webpack config to babel-transpile server code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp.task('compile:app', () => { | |
gulp.src(appfilesPahts) | |
.pipe(webpack(require('webpack.config.app.prod.js') | |
.pipe(gulp.dest(pathDest)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('babel-register'); | |
let webpack = require('webpack'), | |
path = require('path'), | |
fileCopyPlugin = require('copy-webpack-plugin'); | |
var appFilePaths = ['./app.js', './utils/**/*.js', './routes/**/*.js', './db.js', './boot.js', './models/**/*.js']; | |
module.exports = { | |
context: __dirname, | |
output: { | |
// path: 'wwwroot', | |
filename: '[name].js' | |
}, | |
module: { | |
loaders: [ | |
{ | |
target: 'node', | |
test: /\.js$/, | |
include: [ | |
...appFilePaths | |
], | |
exclude: /(node_modules|dist|app|client|config|tests)/, | |
loader: 'babel', | |
query: { | |
presets: ['es2015'] | |
} | |
} | |
] | |
}, | |
// plugins: [ | |
// new fileCopyPlugin([ | |
// { | |
// from: path.join(__dirname, 'utils/**/*.js'), | |
// toType: 'dir' | |
// }, | |
// { | |
// from: path.join(__dirname, 'routes/**/*.js'), | |
// toType: 'dir' | |
// }, | |
// { | |
// from: path.join(__dirname, 'models/**/*.js'), | |
// toType: 'dir' | |
// } | |
// ]) | |
// ], | |
resolve: { | |
extensions: ['', '.js'] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment