Skip to content

Commit

Permalink
Fix .mjs issue with GraphQL 0.13.2 (#715)
Browse files Browse the repository at this point in the history
* Fix .mjs issue with GraphQL 0.13.2

graphql/graphql-js#1272 (comment)

* Fix .mjs still referencing "require"

aws-amplify/amplify-js#686 (comment)
  • Loading branch information
ericclemmons authored and jaredpalmer committed Jul 29, 2018
1 parent bbab21a commit 39ea3a6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/razzle/config/createConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module.exports = (
// It is guaranteed to exist because we tweak it in `env.js`
nodePath.split(path.delimiter).filter(Boolean)
),
extensions: ['.js', '.json', '.jsx', '.mjs'],
extensions: ['.mjs', '.jsx', '.js', '.json'],
alias: {
// This is required so symlinks work during development.
'webpack/hot/poll': require.resolve('webpack/hot/poll'),
Expand Down Expand Up @@ -142,6 +142,12 @@ module.exports = (
],
include: paths.appSrc,
},
// Avoid "require is not defined" errors
{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto",
},
// Transform ES6 with Babel
{
test: /\.(js|jsx|mjs)$/,
Expand Down

0 comments on commit 39ea3a6

Please sign in to comment.