Giter Club home page Giter Club logo

Comments (8)

fmiras avatar fmiras commented on May 11, 2024 2

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.

awei01 avatar awei01 commented on May 11, 2024 2

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.

vlastv avatar vlastv commented on May 11, 2024 1

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.

leo avatar leo commented on May 11, 2024

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.

Obiwarn avatar Obiwarn commented on May 11, 2024

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.

leo avatar leo commented on May 11, 2024

Async and await work on the latest Node.js version by default. The readme shows this...

from micro-dev.

Obiwarn avatar Obiwarn commented on May 11, 2024

from micro-dev.

leo avatar leo commented on May 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.