question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide a watching build mode that writes to the disk in development

See original GitHub issue

See https://github.com/facebookincubator/create-react-app/issues/1018#issuecomment-261792488 for a discussion which leads to the creation of this issue.

I propose adding a new command (working name build-dev) which watches for changes and rebuild the bundle (effectively, given the current CRA implementation, it should execute webpack --watch), then writes it onto filesystem.

The main motivation is an easier integration path with non-Node.js dev servers: such servers could just serve continuously updating bundle from the filesystem.

The only desired configuration options is an --output, which could probably be specified via a command line argument:

% npm run build-dev -- --output ../static/www

Alternative command name suggestions:

  • watch
  • build-watch

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:326
  • Comments:110 (14 by maintainers)

github_iconTop GitHub Comments

83reactions
gaearoncommented, Nov 20, 2016

My concern: the concept of a dev server is already confusing to many people and I’ve seen countless issues from people trying to find dev server output in the filesystem, adding scripts with hrefs to local files, when they didn’t need it.

So I’m worried introducing this feature is useful in some advanced cases but might make everything more confusing in simple cases for people who mistakingly start with build-dev instead because they haven’t seen a dev server before when dev server is exactly what they need.

71reactions
leftdevelcommented, Nov 21, 2016

(As the OP of #1018) : For me it all boils down to:

  • Write the dev bundle that results from running npm start, to the file system.
  • ‘watch’ for changes (in dev mode).

@gaearon makes a great point saying that CRA biggest win is saving the developer from configuring the dev server which is the most difficult feature. I’d be happy if at least we could access the dev bundle.js file from the filesystem, I wouldn’t care if the dev server is started, I would just ignore it.

My argument is that:

CRA is quite appealing to non Node.js developers. There are many experienced developers in python, php, .net out there, but not all of us/them are that experienced in frontend set ups.

CRA makes it a no-brainer to use react. And to be honest, these days it’s way more difficult to set up a React project than an ember or angularjs 1.x project. React API is pretty simple and powerful, but when you introduce React to your organization projects, it’s not just React, but all its friends which are hard to master (webpack, babel, presets, linters, etc).

Not sure if you guys have read this blog post yet https://goo.gl/HviDRn, but it’s about a company that has a backend in Flask and were evaluating a frontend framework. They talk about how difficult is to keep up with the shifting ecosystem around React, and I’d totally agree on their pain points. At the end they chose Emberjs because of their CLI tools that makes it super easy to integrate.

I think CRA was created with the mindset of helping people that are just starting with React, and playing around with a few simple tutorials, but it has the potential of becoming a profesional tool for people that don’t have that much time to spend learning webpack, babel, if to use fetch or superagent, what Promise polyfill to use, etc.

We need something opinionated that just works. Note that I’m totally fine with the already existing features in CRA.

Sorry for the long post. ** flies away **

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack: How to compile, write on disk and serve static ...
Using this configuration, webpack-dev-server will serve the static files in your build folder. It'll watch your source files, and recompile the ...
Read more >
Watch and WatchOptions | webpack
Turn on watch mode. This means that after the initial build, webpack will continue to watch for changes in any of the resolved...
Read more >
Support Direct Boot mode - Android Developers
Test your encryption aware app · On the device, enable Developer options if you haven't already by going to Settings > About phone...
Read more >
3 Common Tasks — The Yocto Project ® 4.1.999 documentation
Layers allow you to isolate different types of customizations from each other. ... the need to write to the disk, thus increasing the...
Read more >
Amazon EC2 FAQs - Amazon Web Services
Amazon EC2 enables any developer to leverage Amazon's own benefits of ... can deliver up to 6.2 GiB/s read and 6.2 GiB/s write...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found