underdog-collie2

CLI tool for compiling production-ready universal JavaScript applications, powered by webpack.

Usage no npm install needed!

<script type="module">
  import underdogCollie2 from 'https://cdn.skypack.dev/underdog-collie2';
</script>

README

Collie

CLI tool for compiling production-ready universal JavaScript applications, powered by webpack.

Installation

npm install underdog-collie

Usage

Create a .babelrc file in the root of your project to configure Babel:

{
  "presets": [
    ["env", {
      "targets": {
        "browsers": ["last 2 versions"],
        "node": "current"
      }
    }],
    "react"
  ]
}

Also create a file named collie.config.js in the root of your project:

// Example collie config
const {join} = require('path');

module.exports = {
  // Specify an array of files to build with webpack.
  build: [{
    // Specify target.
    target: 'browser',

    // Specify entry options to pass to webpack.
    entry: {
      app: join(__dirname, 'browser.js')
    },

    // Specify output
    output: {
      path: join(__dirname, 'dist/static'),
      publicPath: '/static/'
    },

    // Pass options for html-webpack-plugin. Setting html to an array of objects
    // will create a new instance of the html-webpack-plugin with each object.
    html: {
      template: join(__dirname, 'index.html'),
      filename: join(__dirname, 'dist/index.html'),
      inject: true
    }
  }, {
    // Create a JavaScript bundle for server side use.
    target: 'server',
    entry: {
      server: join(__dirname, 'server')
    },
    output: {
      path: join(__dirname, 'dist')
    }
  }]
};

Create a build:

collie build

or watch files for development:

collie build --watch