Comments (11)
This has honestly been really frustrating for me too. Let me explain how things are currently setup, and hopefully we can figure out a better way to do things.
Our build isn't really that strange–it's just a single babel transpile step, which is quite common nowadays, especially in the React community. We use npm's prepublish
script to create the build, which AFAICT is in accordance with npm's script guidelines for running a build step that transpiles one language to another (e.g. CoffeeScript).
The problem in this case is that, although npm runs prepublish
on a local npm install
, it won't do that for remotes (like GitHub). So, yes. Installing from GitHub is broken.
Perhaps @othiym23 has an idea how we can improve this...
from history.
I guess we could use a postinstall
hook that generates the lib
directory if there isn't one already. That might work.
from history.
Either that or we could check our lib
directory into git. But I'd prefer to avoid that.
from history.
Note even with postinstall
it's a bit tricky. See how Radium does it.
cc @ianobermiller who knows why it's done this way.
from history.
@gaearon Ya, that's exactly what I was thinking.
Basically, if the lib
directory is missing then we know we were not installed from the npm package. So build it.
from history.
Wow. Thanks for the quick turnaround on this, guys. Not sure if that commit fixed it (I haven't tried it), but I'll give it a try and let you know.
from history.
@jeffreywescott Nah, that commit doesn't actually fix the problem because the modules
directory is in our .npmignore
. npm currently doesn't handle the transpilation use case very well at all it seems :/
In short, we could fix remote installs but it would mean that we now have to include the ES2015 source (the modules
dir, and probably our .babelrc
too) in our npm package. I dunno. Maybe that's something we actually want to do. Use lib
for our build, modules
for the source. There are a few niche tools that actually support running ES2015 nowadays, and that crowd is only going to get bigger.
from history.
it would mean that we now have to include the ES2015 source (the modules dir, and probably our .babelrc too) in our npm package
I started doing this, and I think it's the way to go. Some people want to look into uncompiled code, or even use ESnext env. And it handles this use case too. Go for it!
from history.
Hey, guys.
I just tried this again today, and things are still not working. I thought the reason why was that package.tgz does not include the .babelrc
file that's necessary for building:
$ npm install
/
> [email protected] postinstall /Users/jeffrey/dev/wisdomlabs/wisdomlabs-com/node_modules/history
> node -e "require('fs').stat('lib', function (e, s) { process.exit(e || !s.isDirectory() ? 1 : 0) })" || npm run build
> [email protected] build /Users/jeffrey/dev/wisdomlabs/wisdomlabs-com/node_modules/history
> babel ./modules -d lib --ignore '__tests__'
modules/Actions.js -> lib/Actions.js
modules/AsyncUtils.js -> lib/AsyncUtils.js
modules/DOMStateStorage.js -> lib/DOMStateStorage.js
modules/DOMUtils.js -> lib/DOMUtils.js
modules/ExecutionEnvironment.js -> lib/ExecutionEnvironment.js
modules/createBrowserHistory.js -> lib/createBrowserHistory.js
modules/createDOMHistory.js -> lib/createDOMHistory.js
modules/createHashHistory.js -> lib/createHashHistory.js
modules/createHistory.js -> lib/createHistory.js
modules/createLocation.js -> lib/createLocation.js
modules/createMemoryHistory.js -> lib/createMemoryHistory.js
modules/enableBeforeUnload.js -> lib/enableBeforeUnload.js
modules/enableQueries.js -> lib/enableQueries.js
SyntaxError: modules/index.js: Unexpected token (1:7)
> 1 | export createHistory from './createBrowserHistory'
| ^
2 | export createHashHistory from './createHashHistory'
3 | export createMemoryHistory from './createMemoryHistory'
4 | export createLocation from './createLocation'
npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/jeffrey/.nvm/versions/io.js/v2.4.0/bin/iojs" "/Users/jeffrey/.nvm/versions/io.js/v2.4.0/bin/npm" "run" "build"
npm ERR! node v2.4.0
npm ERR! npm v2.13.0
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `babel ./modules -d lib --ignore '__tests__'`
npm ERR! Exit status 1
However, even adding --stage 0 --loose
to the npm build
script in package.json
didn't seem to help.
Any ideas?
from history.
AFAICT you need to use --loose all
@jeffreywescott, not just --loose
.
from history.
I just confirmed that with --loose all
it works, @jeffreywescott. I'll push an update to master.
from history.
Related Issues (20)
- Sourcemaps are blank HOT 1
- Use History in redux actions HOT 2
- Location type should have template for unknown for state HOT 3
- doing history.go() does NOT trigger a blocker callback handler HOT 1
- Did TS declaration file disappear for v4? HOT 4
- Wrong action after clicking on Forward button in browser HOT 3
- Need history.BackTo(string)
- Is it possible to access the history bundled into React Router? HOT 1
- globalHistory.pushState function excuted failed in baidu.app
- [v6] Missing hashType={"noslash"} of HashRouter HOT 3
- [react-router-dom v6] HashRouter support HOT 1
- Add index property to BrowserHistory, HashHistory and corresponding Update
- Why `history.length` is gone? HOT 7
- createBrowserHistory() breaks history URL on iOS 11
- history
- is this project abandoned? HOT 2
- Navigate replace without generate new location.key
- hash history url is not parsed correctly with query params
- ReferenceError: document is not defined in Next.JS HOT 1
- No such file or directory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from history.