Modular Code - sgml/signature GitHub Wiki

Instructions

Debugging

  • Turn on all options for verbosity in webpack and babel

  • Comment out code that you don't need if it is causing errors

  • Use default imports and exports since webpack and babel fail with poor error messaging when a named import is used with sourcemaps:

  1. https://github.com/webpack/webpack/issues/4423

  2. https://github.com/webpack/webpack/issues/3957

Organization

  • Use a modular structure like HighCharts or i18next-icu to avoid the need for destructuring exports

  • Use jsfiddle, codepen, or plunker to test things such as open source react components. For example:

  1. https://codepen.io/oneezy/pen/jzWjLe

  2. https://jsfiddle.net/boilerplate/typescript

  3. https://codepen.io/HousewifeHacker/pen/zRRqYe

  4. https://plnkr.co/edit/R1ECDV?p=info

  5. https://codepen.io/simeg/pen/YppLmO

  6. https://codepen.io/andytran/pen/jyEPyL

  • Then map the imports to script tags as follows:
import script
import React from 'react' https://unpkg.com/[email protected]/umd/react.production.min.js
import ReactDOM from 'react-dom' https://unpkg.com/[email protected]/umd/react-dom.production.min.js
import moment from 'moment' https://unpkg.com/[email protected]/moment.js

Prototyping

Use the following code for babel and react without node.js:

<script src="https://unpkg.com/[email protected]/babel.js"></script>
 
<script type="text/babel">
    var contentNode = document.getElementById('content');
    var component = <h1> Hello World </h1>; // A simple JSX component
    ReactDOM.render(component, contentNode); // Render the conponent
</script>

Configuration

  1. decorators
  2. class properties
  3. export-default-from
  4. null coalescing (??)

Reusability

Apache Module

References

⚠️ **GitHub.com Fallback** ⚠️