Skip to content

Commit

Permalink
feat(build): allow building React based custom widgets
Browse files Browse the repository at this point in the history
fixes #373

This is a try at it, not sure this is sufficient
  • Loading branch information
vvo committed Nov 4, 2015
1 parent 0d95b55 commit cfbbfe4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "instantsearch.js",
"version": "0.8.0",
"description": "instantsearch.js is a library of widgets to build high performance instant search experiences using Algolia",
"main": "dist/instantsearch.js",
"main": "dist/instantsearch.module.js",
"author": "Algolia <support@algolia.com>",
"scripts": {
"build": "./scripts/build.sh",
Expand All @@ -15,7 +15,6 @@
"test": "BABEL_ENV=test mocha --opts mocha.opts --reporter dot && npm run lint",
"test:watch": "BABEL_ENV=test mocha --opts mocha.opts --reporter min --watch",
"test:watch:browser": "BABEL_ENV=test karma start",
"watch": "webpack --watch",
"shrinkwrap": "npm-shrinkwrap --dev"
},
"repository": "algolia/instantsearch.js",
Expand All @@ -36,6 +35,7 @@
"eslint-plugin-react": "^3.6.3",
"expect": "^1.12.2",
"expect-jsx": "^2.1.0",
"expose-loader": "^0.7.0",
"gh-pages": "^0.4.0",
"jsdoc-parse": "^1.1.1",
"jsdoc-to-markdown": "^1.2.0",
Expand Down
5 changes: 4 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ license="/*! instantsearch.js ${VERSION:-UNRELEASED} | © Algolia Inc. and other

bundle='instantsearch'

webpack
# build for jsdelivr, with everything inlined while exposing React + ReactDOM (for plugins)
webpack --config webpack.config.jsdelivr.babel.js
# only transpile to ES5 for package.json main entry
babel index.js -o dist/${bundle}.module.js

for source in "$ROOT"/css/[^_]*.scss; do
base=`basename "$source" .scss`
Expand Down
4 changes: 4 additions & 0 deletions webpack.config.babel.js → webpack.config.jsdelivr.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export default {
module: {
loaders: [{
test: /\.js$/, exclude: /node_modules/, loader: 'babel'
}, {
test: require.resolve('react'), loader: 'expose?React'
}, {
test: require.resolve('react-dom'), loader: 'expose?ReactDOM'
}]
},
plugins: [
Expand Down

0 comments on commit cfbbfe4

Please sign in to comment.