Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(build): allow building React based custom widgets #448

Merged
merged 1 commit into from
Nov 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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