4.2.5 • Published 2 years ago

@marko/build v4.2.5

Weekly downloads
334
License
MIT
Repository
github
Last release
2 years ago

Utility to build a node server from a marko file

CLI

Getting Started

npm install @marko/build
marko-build .

or

npx @marko/build .

Example

marko-build .
marko-build ./my-page.marko

Options

  • --output -o: Where to write the build
  • --static: Build static HTML files instead of a node server

Config overrides

While @marko/build works out-of-the box without any config, it does allow customizing and extending the default config for unique use-cases.

Webpack

NOTE: @marko/build currently uses webpack to build projects, however, this may change in the future so it's recommended to avoid using a custom webpack config if possible.

In the most extreme case, you can use a custom webpack.config.js. This config file is discovered based on the entry that is passed to the cli command, but given that it's a standalone config file, you can use webpack directly to build your project as well.

To help configure webpack, @marko/build exports a configBuilder function that allows you to use the base config, while adding your own customizations.

Example

webpack.config.js

import path from "path";
import { configBuilder } from "@marko/build";
import MyPlugin from "my-plugin";

const { getServerConfig, getBrowserConfigs } = configBuilder({
  entry: path.join(__dirname, "target.marko"),
  production: process.env.NODE_ENV === "production"
});

module.exports = [
  ...getBrowserConfigs(config => {
    config.plugins.push(new MyPlugin());
    return config;
  }),
  getServerConfig(config => {
    config.plugins.push(new MyPlugin());
    return config;
  })
];

API

Installation

npm install @marko/build

configBuilder

Returns 3 functions: getServerConfig, getBrowserConfig, and getBrowserConfigs.

Options

  • entry - the marko file to build
  • output - where to write the build
  • production - whether to build in production mode

loadWebpackConfig

Loads a custom webpack.config.js or creates a default array of compiler configs.

Options

  • entry - the marko file to build
  • output - where to write the build
  • production - whether to build in production mode
4.2.5

2 years ago

4.2.4

2 years ago

4.2.3

3 years ago

4.2.2

3 years ago

4.2.1

3 years ago

4.2.0

3 years ago

4.1.4

3 years ago

4.1.3

3 years ago

4.1.2

3 years ago

4.1.1

3 years ago

4.1.0

3 years ago

4.0.0

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.2.5

3 years ago

2.2.4

3 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.2

4 years ago

2.1.3

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.6.4

4 years ago

1.6.5

4 years ago

1.6.3-alpha.0

4 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago