Skip to content

Commit 2d6ab34

Browse files
authored
Add changeset
1 parent 9771321 commit 2d6ab34

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.changeset/seven-rats-taste.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
"extract-react-types-loader": major
3+
---
4+
5+
Remove Atlaskit specific process.env switches (#195)
6+
7+
BREAKING CHANGE
8+
This removes the previously available process.env switches to conditionally disable the loader.
9+
To restore the previous behaviour you'll have to use the `resolveLoader` webpack config, e.g.
10+
11+
```js
12+
// webpack.config.js
13+
const enabled = ['production', 'staging'].includes(process.env.WEBSITE_ENV) || process.env.FORCE_EXTRACT_REACT_TYPES;
14+
15+
module.exports = {
16+
/* ... */
17+
resolveLoader: {
18+
alias: {
19+
'extract-react-types-loader': enabled ? undefined : require.resolve('./noop-extract-react-types-loader')
20+
}
21+
}
22+
};
23+
```
24+
25+
```js
26+
// noop-extract-react-types-loader.js
27+
module.exports = function noopExtractReactPropTypesLoader() {
28+
return `module.exports = {
29+
component: {
30+
kind: 'object',
31+
members: [
32+
{
33+
kind: 'property',
34+
key: { kind: 'id', name: 'Warning' },
35+
value: { kind: 'any' },
36+
optional: false,
37+
leadingComments: [
38+
{
39+
type: 'commentBlock',
40+
value: `extract-react-types is not being run in dev mode for speed reasons. If you need to
41+
see prop types add the environment variable \`FORCE_EXTRACT_REACT_TYPES\`
42+
raw: '**'
43+
}
44+
],
45+
default: {
46+
kind: 'string',
47+
value: 'Prop types are not shown in dev mode'
48+
}
49+
}
50+
],
51+
referenceIdName: 'NoopPropTpes'
52+
}
53+
};`
54+
}
55+
```

0 commit comments

Comments
 (0)