Coder Social home page Coder Social logo

webpack-node-boilerplate's Introduction

I wasn't entirely happy with some of the boilerplates that exist for Node+ES6/ES7, this is a server-side builder for node js server utilities. has jsx support wired in as well. (Although you'll need to add react or do more to make it fully functional, the compiler just compiles it into react.createcomponent code)

This also has an opinionated CONFIG global, so many of my server side projects require a config of some sort, node.js configs naturally are just JS files that get required in. BUT webpack doesn't allow ignoring a single file. It also wouldn't fit within the es6 style, and can get in the way of isomorphic js (browser and server)

I had a few options at my disposal but the one that felt the most correct, was creating a global CONFIG variable as part of this environment. I place that into each compiled file's header block - even though it's conditionally executed.

This means in the browser you can do <script> CONFIG={foo:1} </script>

And code will work as expected... on both client and sever side. The server will dyanmically load the config, the client expects the CONFIG to be defined before being loaded.

On the client side, if you don't automatically create a CONFIG variable, the client will attempt to execute a spurious "require" statement, with obvious results.

Development

Start the watch tool with

npm run watch

Then run the built code with

npm run execute -- [args]

Deployment

Nothing has been done here yet

Build

If you just wish to build it

npm run build

webpack-node-boilerplate's People

Contributors

prozacgod avatar

Watchers

 avatar  avatar

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.