Skip to content

Commit 39ea3a6

Browse files
ericclemmonsjaredpalmer
authored andcommitted
Fix .mjs issue with GraphQL 0.13.2 (#715)
* Fix .mjs issue with GraphQL 0.13.2 graphql/graphql-js#1272 (comment) * Fix .mjs still referencing "require" aws-amplify/amplify-js#686 (comment)
1 parent bbab21a commit 39ea3a6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/razzle/config/createConfig.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ module.exports = (
114114
// It is guaranteed to exist because we tweak it in `env.js`
115115
nodePath.split(path.delimiter).filter(Boolean)
116116
),
117-
extensions: ['.js', '.json', '.jsx', '.mjs'],
117+
extensions: ['.mjs', '.jsx', '.js', '.json'],
118118
alias: {
119119
// This is required so symlinks work during development.
120120
'webpack/hot/poll': require.resolve('webpack/hot/poll'),
@@ -142,6 +142,12 @@ module.exports = (
142142
],
143143
include: paths.appSrc,
144144
},
145+
// Avoid "require is not defined" errors
146+
{
147+
test: /\.mjs$/,
148+
include: /node_modules/,
149+
type: "javascript/auto",
150+
},
145151
// Transform ES6 with Babel
146152
{
147153
test: /\.(js|jsx|mjs)$/,

0 commit comments

Comments
 (0)