Comments (13)
I commited a new bin/build implementation in full nodejs, hopefully solving your issues.
Just run npm run dev
and it will:
- build
- serve on port 10001
- watch for change and rebuild + reload
from leviathan.
Ah, no problem! FYI I finally use Webpack (but with Rollup behind) to simplify and standardize the build process and dev tools. Watching files is not ideal right now, but I made a PR to rollup-loader to improve this, cf egoist/rollup-loader#11
from leviathan.
I figured out that I needed to run the /bin/dev-server script with node. I installed node 7.9.0 since the async function was not working with v6 of node. So when I run node bin/devserver
I get the following error:
Temporary directory: /Users/thoragio/code/leviathan/tmp-leviathan-bY9ntU
Listen: localhost:8080
Upstreams:
/ /Users/thoragio/code/leviathan/
Generating certificates...
Launching HTTP server (use ^C to quit)...
events.js:163
throw er; // Unhandled 'error' event
^
Error: spawn nginx ENOENT
at exports._errnoException (util.js:1050:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
I'm guessing I need to install nginx on my machine. I'll try that next when I have some more time later today.
from leviathan.
Thanks a lot for taking the time to post your code @thoragio !
Clever thing to directly set the path for the new openssl version in the /bin/build file, I'm on OS X too so I was facing the same issue.
from leviathan.
Rollup really needs stuff like webpack-dev-server
and html-webpack-plugin
:D
from leviathan.
Asking myself the same question as @thoragio
from leviathan.
Hi, thank you for your interest! Please know that this project is just a start and you can't do much with it right now.
I should remove the bin/dev-server
script as it isn't needed: just serve the dist
server with any commandline dev server and it should work:
- with python 2 :
cd dist && python2 -m SimpleHTTPServer
- with python 3 :
cd dist && python -m http.server
- with php :
cd dist && php -S localhost:8000
- if you want to stick with nodejs, you can use
http-server
(npm install http-server
)
Also if you want to rebuild things when developping, you can watch for changes with $(npm bin)/rollup -c -w
from leviathan.
Thanks @BenoitZugmeyer. Running it with live-server (node) works great.
@theChesCat Here's what my bin/build file looks like now:
#!/bin/bash
set -euo pipefail
BIN="$(npm bin)"
cd $(dirname $0)/..
rm -rf dist
mkdir dist
cp -r assets/* dist
"$BIN"/rollup -c
"$BIN"/babili dist/index.js -o dist/index.js
hash=$(/usr/local/opt/openssl/bin/openssl sha256 dist/index.js | tail -c 65)
sed -i -e "s/BUNDLE_NAME/index.js?$hash/" dist/index.html
"$BIN"/rollup -c -w
And here's how it diffs from the original:
-hash=$(openssl sha256 dist/index.js | tail -c 65)
-sed -i "s/BUNDLE_NAME/index.js?$hash/" dist/index.html
+hash=$(/usr/local/opt/openssl/bin/openssl sha256 dist/index.js | tail -c 65)
+sed -i -e "s/BUNDLE_NAME/index.js?$hash/" dist/index.html
+"$BIN"/rollup -c -w
Note that the full path for openssl is a bit of a hack on my side because I don't want to rewrite the path for everything in case it breaks anything else relying on the older version of openssl that is still installed by default in OS X.
from leviathan.
Thanks a lot!
from leviathan.
Thank you. Much appreciated.
from leviathan.
(Or you need to use Webpack )
from leviathan.
@BenoitZugmeyer Thanks for the tutorial with 3 examples today. I think you thoroughly answered my original question which was the title of this issue: how to run a dev server! 🙌
from leviathan.
Awesome! It's already been merged earlier this morning. 💨
from leviathan.
Related Issues (1)
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 leviathan.