Skip to content

Instantly share code, notes, and snippets.

@kkeeth
Last active June 13, 2017 07:39
Show Gist options
  • Save kkeeth/a9e93d131a4a01325cd7b2c7be306a36 to your computer and use it in GitHub Desktop.
Save kkeeth/a9e93d131a4a01325cd7b2c7be306a36 to your computer and use it in GitHub Desktop.
ES6(ES2015)用のサンプル集
/** gulpの設定例 **/
const gulp = require("gulp"),
buble = require("gulp-buble")
gulp.task('buble', () => {
gulp.src('./es6/*.js')
.pipe(buble())
.pipe(gulp.dest('./js/'))
});
gulp.task('watch', () => {
gulp.watch('./es6/*.js', ['buble'])
});
gulp.task('default', ['buble', 'watch']);
import buble from 'rollup-plugin-buble'
import commonjs from 'rollup-plugin-commonjs'
// 必要があればコメントアウトを外す
// import node_resolve from 'rollup-plugin-node-resolve'
// import multi_entry from 'rollup-plugin-multi-entry'
export default {
entry: 'src/app.js',
dest: 'build/bundle.js',
format: 'es',
// 必要があればコメントアウトを外す
// sourceMap: true,
plugins: [
// 必要があればコメントアウトを外す
// node_resolve({ jsnext: true }),
// multi_entry(),
commonjs(),
buble()
]
}
/** webpackの設定例 **/
const path = require('path'),
webpack = require('webpack'),
glob = require('glob')
module.exports = [
{
entry: glob.sync('./es6/*.js'),
output: {
path: path.resolve(__dirname + '/build/'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
enforce: 'post',
exclude: /node_modules/,
loader: 'buble-loader'
}
]
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment