Skip to content

Instantly share code, notes, and snippets.

@kmtr
Created October 12, 2015 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmtr/c2249dfead351ef28097 to your computer and use it in GitHub Desktop.
Save kmtr/c2249dfead351ef28097 to your computer and use it in GitHub Desktop.
import webpack from "webpack";
import glob from "glob";
import path from "path";
let vendorModules = /(node_modules)/;
let entryFiles = glob.sync("./src/**/*.js");
let entries = {};
for (let f of entryFiles) {
let tmp = f.split("/");
tmp = tmp[tmp.length - 1].split(".");
entries[tmp[0]] = f;
}
export default {
target: "web",
entry: entries,
output: {
path: path.join(__dirname, 'build/js'),
filename: '[name].js',
pathinfo: true,
publishPath: "",
},
module: {
preLoaders: [{
test: /\.jsx?$/,
loader: "eslint-loader",
exclude: vendorModules
}, ],
loaders: [{
test: /\.jsx?$/,
exclude: vendorModules,
loader: "babel",
query: {
optional: [
"runtime",
"validation.undeclaredVariableCheck",
"optimisation.react.constantElements",
],
env: {
development: {
plugins: [
"typecheck",
"closure-elimination",
],
},
},
jsxPragma: "hJSX",
stage: 0,
},
}],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
],
};
/*
"devDependencies": {
"babel": "^5.8.23",
"babel-core": "^5.8.25",
"babel-loader": "^5.3.2",
"babel-plugin-closure-elimination": "0.0.2",
"babel-plugin-typecheck": "^1.3.0",
"babel-runtime": "^5.8.25",
"eslint": "^1.6.0",
"eslint-plugin-react": "^3.5.1",
"glob": "^5.0.15",
"json5": "^0.4.0",
"path": "^0.12.7",
"webpack": "^1.12.2"
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment