Skip to content

Commit

Permalink
Update build
Browse files Browse the repository at this point in the history
  • Loading branch information
nkbt committed Jan 9, 2018
1 parent 4fc100a commit 256a92b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion scripts/lint.js
Expand Up @@ -5,4 +5,4 @@
const {npm, CWD} = require(`./utils/bash`);


npm(`eslint --fix .`, {cwd: CWD});
npm(`eslint .`, {cwd: CWD});
25 changes: 18 additions & 7 deletions scripts/utils/webpack/common.js
Expand Up @@ -5,6 +5,9 @@ const webpack = require(`webpack`);
const HtmlWebpackPlugin = require(`html-webpack-plugin`);
const HtmlWebpackIncludeAssetsPlugin = require(`html-webpack-include-assets-plugin`);
const path = require(`path`);
const BabiliPlugin = require(`babili-webpack-plugin`);


const {NODE_ENV = `development`} = process.env;


Expand All @@ -18,12 +21,17 @@ const {
externals: COMPONENT_EXTERNALS = {
[`react`]: `React`,
[`react-dom`]: `ReactDOM`
}
},
include: INCLUDE_JS = [
`https://unpkg.com/react/umd/react.production.min.js`,
`https://unpkg.com/react-dom/umd/react-dom.production.min.js`
]
},
name: PACKAGE_NAME
} = require(pathTo(`package.json`));
exports.PACKAGE_NAME = PACKAGE_NAME;
exports.COMPONENT_NAME = COMPONENT_NAME;
exports.INCLUDE_JS = INCLUDE_JS;


if (!COMPONENT_NAME) {
Expand All @@ -47,8 +55,8 @@ exports.loaders = {
options: {
babelrc: false,
presets: [
[`es2015`, {modules: false}],
`react`
`react`,
[`env`, {modules: false}]
],
plugins: [
`transform-object-rest-spread`,
Expand All @@ -66,12 +74,17 @@ exports.loaders = {
};


const babiliPlugin = new BabiliPlugin({
mergeVars: false
}, {sourceMap: false});


exports.plugins = {
define: new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(NODE_ENV)
}),
html: new HtmlWebpackPlugin(),
uglify: new webpack.optimize.UglifyJsPlugin(),
uglify: babiliPlugin,
include: assets => new HtmlWebpackIncludeAssetsPlugin({
assets,
append: false
Expand All @@ -82,9 +95,7 @@ exports.plugins = {
};


exports.resolve = {
extensions: [`.js`]
};
exports.resolve = {};


exports.stats = {colors: true};
Expand Down
10 changes: 3 additions & 7 deletions scripts/utils/webpack/pub.config.js
Expand Up @@ -9,7 +9,8 @@ const {
loaders,
resolve,
stats,
externals
externals,
INCLUDE_JS
} = require(`./common`);


Expand All @@ -23,12 +24,7 @@ module.exports = {
plugins: [
plugins.define,
plugins.html,
plugins.include([
`https://unpkg.com/react/dist/react.min.js`,
`https://unpkg.com/react-dom/dist/react-dom.min.js`,
`https://unpkg.com/react-motion/build/react-motion.js`,
`styles.css`
]),
plugins.include(INCLUDE_JS.concat([`styles.css`])),
new ExtractTextPlugin(`styles.css`)
],
module: {
Expand Down

0 comments on commit 256a92b

Please sign in to comment.