Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Make the library and react-components presets target IE9 by default (#…
Browse files Browse the repository at this point in the history
…994)

To ensure that their output is fully ES5 compatible.

Fixes #722.
Fixes #781.
Supersedes #948.
  • Loading branch information
acconrad authored and edmorley committed Jul 13, 2018
1 parent 38d54f3 commit 3440500
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
9 changes: 3 additions & 6 deletions packages/library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

- Zero upfront configuration necessary to start developing and building a JavaScript library
- Modern Babel compilation supporting ES modules, async functions, and dynamic imports
- Compiles to ES5 to support major browsers, publishing to npm, and library
interoperability
- Defaults to UMD-based output for consumption in a variety of environments
- Supports automatically-wired sourcemaps
- Tree-shaking to create smaller bundles
Expand Down Expand Up @@ -257,12 +259,7 @@ module.exports = {
['@babel/preset-env', {
// Passing in browser targets to @babel/preset-env will replace them
// instead of merging them when using the 'web' target
targets: {
browsers: [
'last 1 Chrome versions',
'last 1 Firefox versions'
]
}
targets: { browsers: 'ie 9' }
}]
]
}
Expand Down
15 changes: 1 addition & 14 deletions packages/library/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,12 @@ module.exports = (neutrino, opts = {}) => {
useBuiltIns: 'entry',
targets: options.target === 'node' ?
{ node: '8.3' } :
{ browsers: [] }
{ browsers: 'ie 9' }
}]
]
}, options.babel)
});

const { targets } = options.babel.presets[0][1];

if (targets.browsers && !targets.browsers.length) {
targets.browsers.push(
'last 2 Chrome versions',
'last 2 Firefox versions',
'last 2 Edge versions',
'last 2 Opera versions',
'last 2 Safari versions',
'last 2 iOS versions'
);
}

const pkg = neutrino.options.packageJson;
const hasSourceMap = (pkg.dependencies && 'source-map-support' in pkg.dependencies) ||
(pkg.devDependencies && 'source-map-support' in pkg.devDependencies);
Expand Down
4 changes: 3 additions & 1 deletion packages/react-components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ other Neutrino middleware, so you can build, test, and publish multiple React co
- Support for React Hot Loader
- Write JSX in .js or .jsx files
- Support for importing web workers with `.worker.*` file extensions
- Compiles to ES5 to support major browsers, publishing to npm, and library
interoperability
- Extends partially from [@neutrinojs/web](https://neutrinojs.org/packages/web/)
- Modern Babel compilation supporting ES modules, last 2 major browser versions, async functions, and dynamic imports
- Modern Babel compilation supporting ES modules, async functions, and dynamic imports
- webpack loaders for importing HTML, CSS, images, icons, fonts, and web workers
- webpack Dev Server during development
- Automatic stylesheet extraction; importing stylesheets into modules creates bundled external stylesheets
Expand Down
3 changes: 2 additions & 1 deletion packages/react-components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ module.exports = (neutrino, opts = {}) => {
},
manifest: mode === 'development',
externals: opts.externals !== false && {},
style: { extract: { plugin: { filename: '[name].css' } } }
style: { extract: { plugin: { filename: '[name].css' } } },
targets: { browsers: 'ie 9' }
}, opts);

neutrino.config.when(
Expand Down

0 comments on commit 3440500

Please sign in to comment.