Comments (8)
I'm working with micro-dev & PhantomJS to make some webscrappers workers. The thing is that Phantom supports very few ES2015 features (something about of 10%) so I want to still use Babel and of course, not just for import statements but now I have the work of running npm run build
every time I want micro-dev to hot-reload and If I want to automatically build the source code I have to spawn 2 processes, micro-dev and webpack and that isn't efficient. Can we reopen this issue to find a solution for this? I was thinking of making a micro-dev support programmatically API as same micro does or building a webpack-plugin for it.
from micro-dev.
Hi, this might be a naive solution, but it seems to be working:
// index.js
require('babel-register')
const foo = require('./foo').default
module.exports = function (req, res) {
const value = foo()
console.log('serving stuff', value)
res.end("Hello, world " + value)
}
// foo.js
export default () {
return 'foo value'
}
then just micro index.js
or micro-dev index.js
from micro-dev.
I, too, am waiting for a normal decision and while I launch it as:
$ ./node_modules/.bin/babel-node ./node_modules/.bin/micro-dev ...
from micro-dev.
Use a build tool like Gulp or Webpack + Babel that transpiles and bundles your source code into a directory and then do: micro-dev <output-dir>
from micro-dev.
thanks for answering.
this is probably overkill just to get micro-dev. i hoped there was a more elegant solution. like in the Minimum Viable Async example from rauchg: https://gist.github.com/pid/e922b18a944184d881e5164120db2a65
from micro-dev.
Async and await work on the latest Node.js version by default. The readme shows this...
from micro-dev.
from micro-dev.
Yea... π As the repo states it, at the current state of Node.js (which supports most of ES2015 already), transpilation doesnβt make much sense server-side.
from micro-dev.
Related Issues (20)
- Restore compatibility with micro@canary
- Update chokidar to v3 HOT 1
- Add cli arguments to documentation
- apollo-server-micro floods console with introspection logs HOT 3
- Provide an option to disable the auto copy to clipboard behaviour
- --ignore option not accepting glob HOT 1
- micro with next js restart every time on next compile
- micro-dev restarts on non-source code changes
- Yargs Parser Security Vulnerability
- Update all dependencies HOT 1
- Add ESLint and move to TypeScript
- print name of module file being used on startup.
- Purpose of SIGUSR2 signal? HOT 1
- Not compatible with `micro` v10.x HOT 3
- Windows node debugger: SyntaxError: missing ) after argument list HOT 1
- micro-dev exits on error HOT 3
- error Command failed with exit code 140 HOT 1
- UnhandledPromiseRejectionWarning thrown when content-type is not sent HOT 1
- add to readme: how to use custom now.json files with now-env
- Disable console logging? HOT 3
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 micro-dev.