diff --git a/tasks/build b/tasks/build index f5388b0..7fbaafe 100755 --- a/tasks/build +++ b/tasks/build @@ -17,4 +17,4 @@ eval "MINIFY=1 $BUILD" # Copy package cp README.md build/ -node -p 'p=require("./package");p.main="lib/main.js";p.scripts=p.devDependencies=undefined;JSON.stringify(p,null,2)' > build/package.json +node -p 'p=require("./package");p.scripts=p.devDependencies=undefined;JSON.stringify(p,null,2)' > build/package.json diff --git a/webpack.build.js b/webpack.build.js index e321adc..a8aae3e 100644 --- a/webpack.build.js +++ b/webpack.build.js @@ -5,6 +5,10 @@ var COMPONENT_FILE = process.env.COMPONENT_FILE; var COMPONENT_NAME = process.env.COMPONENT_NAME; var plugins = []; +function getPackageMain() { + return require(path.resolve(BASE_DIR, 'package.json')).main; +} + if (process.env.MINIFY) { plugins.push( new webpack.optimize.UglifyJsPlugin() @@ -13,7 +17,7 @@ if (process.env.MINIFY) { } module.exports = { - entry: path.resolve(BASE_DIR, 'lib/main.js'), + entry: path.resolve(BASE_DIR, getPackageMain()), output: { filename: path.resolve(BASE_DIR, 'dist/' + COMPONENT_FILE + '.js'), library: COMPONENT_NAME,