Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STRWEB-22 export babel config options #26

Merged
merged 3 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Change history for stripes-webpack

## 1.3.0 IN PROGRESS
## 1.4.0 IN PROGRESS

* Lock onto `optimize-css-assets-webpack-plugin` `5.0.6` to avoid `postcss` `v8`. Fixes STRWEB-19.
* Add `loose` to `plugin-proposal-private-property-in-object`. Fixes STRWEB-21.
* Export babel config options for consumption by other modules. Refs STRWEB-22, STRIPES-742.
zburke marked this conversation as resolved.
Show resolved Hide resolved

## [1.3.0](https://github.com/folio-org/stripes-webpack/tree/v1.3.0) (2021-06-08)
[Full Changelog](https://github.com/folio-org/stripes-webpack/compare/v1.2.0...v1.3.0)
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const babelOptions = require('./webpack/babel-options');
module.exports = {
babelOptions,
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/stripes-webpack",
"version": "1.3.0",
"version": "1.4.0",
"description": "The webpack config for stripes",
"license": "Apache-2.0",
"publishConfig": {
Expand Down
30 changes: 2 additions & 28 deletions webpack/babel-loader-rule.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path');
const babelOptions = require('./babel-options');

// a space delimited list of strings (typically namespaces) to use in addition
// to "@folio" to determine if something needs Stripes-flavoured transpilation
Expand Down Expand Up @@ -39,33 +40,6 @@ module.exports = {
loader: 'babel-loader',
options: {
cacheDirectory: true,
presets: [
['@babel/preset-env', { targets: '> 0.25%, not dead' }],
['@babel/preset-flow', { all: true }],
['@babel/preset-react', {
"runtime": "automatic"
}],
['@babel/preset-typescript'],
],
plugins: [
['@babel/plugin-proposal-decorators', { 'legacy': true }],
// when building a platform directly, i.e. outside a workspace,
// babel complains loudly and repeatedly that when these modules are enabled:
// * @babel/plugin-proposal-class-properties,
// * @babel/plugin-proposal-private-methods and
// * @babel/plugin-proposal-private-property-in-object
// the "loose" option must be the same for all three.
// but @babel/preset-env sets it to false for ...private-methods.
// overriding it here silences the complaint. STRWEB-12
['@babel/plugin-proposal-class-properties', { 'loose': true }],
['@babel/plugin-proposal-private-methods', { 'loose': true }],
['@babel/plugin-proposal-private-property-in-object', { 'loose': true }],
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-function-sent',
'@babel/plugin-proposal-numeric-separator',
'@babel/plugin-proposal-throw-expressions',
'@babel/plugin-syntax-import-meta',
[require.resolve('react-hot-loader/babel')],
]
...babelOptions,
},
};
30 changes: 30 additions & 0 deletions webpack/babel-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
presets: [
['@babel/preset-env', { targets: '> 0.25%, not dead' }],
['@babel/preset-flow', { all: true }],
['@babel/preset-react', {
"runtime": "automatic"
}],
['@babel/preset-typescript'],
],
plugins: [
['@babel/plugin-proposal-decorators', { 'legacy': true }],
// when building a platform directly, i.e. outside a workspace,
// babel complains loudly and repeatedly that when these modules are enabled:
// * @babel/plugin-proposal-class-properties,
// * @babel/plugin-proposal-private-methods and
// * @babel/plugin-proposal-private-property-in-object
// the "loose" option must be the same for all three.
// but @babel/preset-env sets it to false for ...private-methods.
// overriding it here silences the complaint. STRWEB-12
['@babel/plugin-proposal-class-properties', { 'loose': true }],
['@babel/plugin-proposal-private-methods', { 'loose': true }],
['@babel/plugin-proposal-private-property-in-object', { 'loose': true }],
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-function-sent',
'@babel/plugin-proposal-numeric-separator',
'@babel/plugin-proposal-throw-expressions',
'@babel/plugin-syntax-import-meta',
[require.resolve('react-hot-loader/babel')],
],
};