npm

@financial-times/dotcom-build-js
TypeScript icon, indicating that this package has built-in type declarations

11.2.1 • Public • Published

@financial-times/dotcom-build-js

This package exports a Webpack plugin to configure it with the ability to build JavaScript that makes use of features that are specific to ft.com.

Getting started

This module is compatible with Node 12+ and is distributed on npm.

npm install --save-dev @financial-times/dotcom-build-js

After installing the module you must add it to the list of plugins in your project's webpack.config.js configuration file:

+ const { PageKitJsPlugin } = require('@financial-times/dotcom-build-js')

module.exports = {
  plugins: [
+    new PageKitJsPlugin(options)
  ]
}

Babel

This plugin configures Babel to compile JavaScript syntax and features that aren't supported by every browser into JavaScript that is. The browsers we target are:

  • the latest version of Chrome
  • the lastest version of Edge
  • Safari 9.1
  • Firefox Extended Support Release

As well as features in current JavaScript standards, we also compile these non-standard features:

dotcom-build-js can be configured with options. Other methods of configuring Babel are not supported by Page Kit, because it's possible to produce output that doesn't work in the browsers we support, or to hurt performance by producing inconsistent output between apps, reducing caching effectiveness.

Options

Option Type Default Description
jsxPragma String "h" See https://babeljs.io/docs/en/babel-preset-react#pragma
jsxPragmaFrag String "Fragment" See https://babeljs.io/docs/en/babel-preset-react#pragmafrag

Readme

Keywords

none

Package Sidebar

Install

npm i @financial-times/dotcom-build-js

Weekly Downloads

393

Version

11.2.1

License

MIT

Unpacked Size

169 kB

Total Files

10

Last publish

Collaborators

  • robgodfrey
  • robertboulton
  • seraph2000
  • hamza.samih
  • notlee
  • emmalewis
  • aendra
  • the-ft
  • rowanmanning
  • chee
  • alexwilson