Skip to content

Instantly share code, notes, and snippets.

@VovanSuper
Last active April 11, 2017 13:01
Show Gist options
  • Save VovanSuper/8edf6ee6583e0b79879ae47d7486ff5e to your computer and use it in GitHub Desktop.
Save VovanSuper/8edf6ee6583e0b79879ae47d7486ff5e to your computer and use it in GitHub Desktop.
webpack config to babel-transpile server code
gulp.task('compile:app', () => {
gulp.src(appfilesPahts)
.pipe(webpack(require('webpack.config.app.prod.js')
.pipe(gulp.dest(pathDest));
});
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