Created
March 18, 2016 06:10
-
-
Save karlbright/947fb5111caf1b8c1729 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var path = require('path') | |
var babel = require('babel-loader') | |
var css = require('css-loader') | |
module.exports = function (source, map) { | |
switch (path.extname(this.resourcePath)) { | |
case '.js': return babel.apply(this, arguments) | |
case '.css': return css.apply(this, arguments) | |
default: return source | |
} | |
} |
This file contains hidden or 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
var fs = require('fs') | |
var path = require('path') | |
var webpack = require('webpack') | |
var meta = require('../') | |
var entriesDirectory = path.join(__dirname, 'entries') | |
var buildsDirectory = path.join(__dirname, 'builds') | |
var entries = {} | |
fs.readdirSync(entriesDirectory).forEach(function (entry) { | |
var entryName = path.basename(entry, path.extname(entry)) | |
entries[entryName] = './' + path.relative(__dirname, path.join(entriesDirectory, entry)) | |
}) | |
webpack({ | |
debug: true, | |
context: __dirname, | |
entry: entries, | |
output: { path: buildsDirectory, filename: '[name].js' }, | |
module: { loaders: [{ loader: 'meta-loader' }] } | |
}, function () { | |
console.log('complete') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment