Skip to content

Commit

Permalink
fix(PnP): use require.resolve on setBabelPreset (#14288)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanis authored and pieh committed May 24, 2019
1 parent eaa08cf commit 5e54afe
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions packages/gatsby-plugin-emotion/src/__tests__/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe(`gatsby-plugin-emotion`, () => {

expect(actions.setBabelPreset).toHaveBeenCalledTimes(1)
expect(actions.setBabelPreset).toHaveBeenCalledWith({
name: `@emotion/babel-preset-css-prop`,
name: expect.stringContaining(`@emotion/babel-preset-css-prop`),
options: {
sourceMap: true,
autoLabel: true,
Expand All @@ -25,7 +25,7 @@ describe(`gatsby-plugin-emotion`, () => {

expect(actions.setBabelPreset).toHaveBeenCalledTimes(1)
expect(actions.setBabelPreset).toHaveBeenCalledWith({
name: `@emotion/babel-preset-css-prop`,
name: expect.stringContaining(`@emotion/babel-preset-css-prop`),
options: {
sourceMap: true,
autoLabel: true,
Expand Down Expand Up @@ -53,7 +53,7 @@ describe(`gatsby-plugin-emotion`, () => {

expect(actions.setBabelPreset).toHaveBeenCalledTimes(1)
expect(actions.setBabelPreset).toHaveBeenCalledWith({
name: `@emotion/babel-preset-css-prop`,
name: expect.stringContaining(`@emotion/babel-preset-css-prop`),
options: {
sourceMap: false,
autoLabel: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-emotion/src/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const onCreateBabelConfig = ({ actions }, pluginOptions) => {
actions.setBabelPreset({
name: `@emotion/babel-preset-css-prop`,
name: require.resolve(`@emotion/babel-preset-css-prop`),
options: {
sourceMap: process.env.NODE_ENV !== `production`,
autoLabel: process.env.NODE_ENV !== `production`,
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-flow/src/__tests__/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe(`gatsby-plugin-flow`, () => {

expect(actions.setBabelPreset).toHaveBeenCalledTimes(1)
expect(actions.setBabelPreset).toHaveBeenCalledWith({
name: `@babel/preset-flow`,
name: expect.stringContaining(`@babel/preset-flow`),
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-flow/src/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const onCreateBabelConfig = ({ actions }, pluginOptions) => {
actions.setBabelPreset({
name: `@babel/preset-flow`,
name: require.resolve(`@babel/preset-flow`),
})
}
4 changes: 2 additions & 2 deletions packages/gatsby-plugin-glamor/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ exports.onCreateWebpackConfig = ({ actions, plugins }) =>
// Add Glamor babel plugin
exports.onCreateBabelConfig = ({ actions }) => {
actions.setBabelPlugin({
name: `glamor/babel-hoist`,
name: require.resolve(`glamor/babel-hoist`),
})
actions.setBabelPreset({
name: `@babel/preset-react`,
name: require.resolve(`@babel/preset-react`),
options: {
pragma: `Glamor.createElement`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe(`gatsby-plugin-typescript`, () => {
}
onCreateBabelConfig({ actions }, options)
expect(actions.setBabelPreset).toHaveBeenCalledWith({
name: `@babel/preset-typescript`,
name: expect.stringContaining(`@babel/preset-typescript`),
options,
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-typescript/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const resolvableExtensions = () => [`.ts`, `.tsx`]

function onCreateBabelConfig({ actions }, options) {
actions.setBabelPreset({
name: `@babel/preset-typescript`,
name: require.resolve(`@babel/preset-typescript`),
options,
})
}
Expand Down

0 comments on commit 5e54afe

Please sign in to comment.