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

Fix eagerEsModules flag in babel-plugin-relay #3724

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion packages/babel-plugin-relay/BabelPluginRelay.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export type RelayPluginOptions = {
isDevVariableName?: string,

// enable generating eager es modules for modern runtime
eagerESModules?: boolean,
eagerEsModules?: boolean,

// Directory as specified by artifactDirectory when running relay-compiler
artifactDirectory?: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('`development` option', () => {
it('tests the hash when `development` is set', () => {
expect(
transformerWithOptions(
{eagerESModules: true},
{eagerEsModules: true},
'development',
)('graphql`fragment TestFrag on Node { id }`'),
).toMatchSnapshot();
Expand All @@ -25,7 +25,7 @@ describe('`development` option', () => {
it('tests the hash when `isDevVariable` is set', () => {
expect(
transformerWithOptions({
eagerESModules: true,
eagerEsModules: true,
isDevVariableName: 'IS_DEV',
})('graphql`fragment TestFrag on Node { id }`'),
).toMatchSnapshot();
Expand All @@ -36,7 +36,7 @@ describe('`development` option', () => {
transformerWithOptions(
{
buildCommand: 'relay-compiler',
eagerESModules: true,
eagerEsModules: true,
},
'development',
)('graphql`fragment TestFrag on Node { id }`'),
Expand All @@ -46,7 +46,7 @@ describe('`development` option', () => {
it('does not test the hash when `development` is not set', () => {
expect(
transformerWithOptions(
{eagerESModules: true},
{eagerEsModules: true},
'production',
)('graphql`fragment TestFrag on Node { id }`'),
).toMatchSnapshot();
Expand Down
8 changes: 4 additions & 4 deletions packages/babel-plugin-relay/compileGraphQLTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function compileGraphQLTag(
);
}

const eagerESModules = state.opts?.eagerESModules ?? false;
const eagerEsModules = state.opts?.eagerEsModules ?? false;
const isHasteMode = state.opts?.jsModuleFormat === 'haste';
const isDevVariable = state.opts?.isDevVariableName;
const artifactDirectory = state.opts?.artifactDirectory;
Expand All @@ -67,7 +67,7 @@ function compileGraphQLTag(

return createNode(t, state, path, definition, {
artifactDirectory,
eagerESModules,
eagerEsModules,
buildCommand,
isDevelopment,
isHasteMode,
Expand All @@ -90,7 +90,7 @@ function createNode(
// If an output directory is specified when running relay-compiler this should point to that directory
artifactDirectory: ?string,
// Generate eager es modules instead of lazy require
eagerESModules: boolean,
eagerEsModules: boolean,
// The command to run to compile Relay files, used for error messages.
buildCommand: string,
// Generate extra validation, defaults to true.
Expand Down Expand Up @@ -136,7 +136,7 @@ function createNode(
),
);

if (options.eagerESModules) {
if (options.eagerEsModules) {
const importDeclaration = t.ImportDeclaration(
[t.ImportDefaultSpecifier(id)],
t.StringLiteral(requiredPath),
Expand Down