File tree 7 files changed +81
-0
lines changed
fixtures/smoke/graphql-with-mjs
packages/react-scripts/config
7 files changed +81
-0
lines changed Original file line number Diff line number Diff line change
1
+ const {
2
+ bootstrap,
3
+ isSuccessfulDevelopment,
4
+ isSuccessfulProduction,
5
+ } = require ( '../../utils' ) ;
6
+ beforeEach ( async ( ) => {
7
+ await bootstrap ( { directory : global . testDirectory , template : __dirname } ) ;
8
+ } ) ;
9
+
10
+ describe ( 'graphql with mjs entrypoint' , ( ) => {
11
+ it ( 'builds in development' , async ( ) => {
12
+ await isSuccessfulDevelopment ( { directory : global . testDirectory } ) ;
13
+ } ) ;
14
+ it ( 'builds in production' , async ( ) => {
15
+ await isSuccessfulProduction ( { directory : global . testDirectory } ) ;
16
+ } ) ;
17
+ } ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "dependencies" : {
3
+ "apollo-boost" : " 0.1.16" ,
4
+ "graphql" : " 14.0.2" ,
5
+ "react-apollo" : " 2.2.1" ,
6
+ "react" : " latest" ,
7
+ "react-dom" : " latest" ,
8
+ "react-scripts" : " latest"
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < title > React App</ title >
5
+ </ head >
6
+ < body >
7
+ < div id ="root "> </ div >
8
+ </ body >
9
+ </ html >
Original file line number Diff line number Diff line change
1
+ import React , { Component } from 'react' ;
2
+
3
+ import ApolloClient from 'apollo-boost' ;
4
+ import { ApolloProvider } from 'react-apollo' ;
5
+
6
+ const client = new ApolloClient ( {
7
+ uri : '/whatever' ,
8
+ } ) ;
9
+
10
+ class App extends Component {
11
+ render ( ) {
12
+ return (
13
+ < ApolloProvider client = { client } >
14
+ < div />
15
+ </ ApolloProvider >
16
+ ) ;
17
+ }
18
+ }
19
+
20
+ export default App ;
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import ReactDOM from 'react-dom' ;
3
+ import App from './App' ;
4
+
5
+ ReactDOM . render ( < App /> , document . getElementById ( 'root' ) ) ;
Original file line number Diff line number Diff line change @@ -187,6 +187,16 @@ module.exports = {
187
187
] ,
188
188
include : paths . appSrc ,
189
189
} ,
190
+ {
191
+ // `mjs` support is still in its infancy in the ecosystem, so we don't
192
+ // support it.
193
+ // Modules who define their `browser` or `module` key as `mjs` force
194
+ // the use of this extension, so we need to tell webpack to fall back
195
+ // to auto mode (ES Module interop, allows ESM to import CommonJS).
196
+ test : / \. m j s $ / ,
197
+ include : / n o d e _ m o d u l e s / ,
198
+ type : 'javascript/auto' ,
199
+ } ,
190
200
{
191
201
// "oneOf" will traverse all following loaders until one will
192
202
// match the requirements. When no loader matches it will fall
Original file line number Diff line number Diff line change @@ -244,6 +244,16 @@ module.exports = {
244
244
] ,
245
245
include : paths . appSrc ,
246
246
} ,
247
+ {
248
+ // `mjs` support is still in its infancy in the ecosystem, so we don't
249
+ // support it.
250
+ // Modules who define their `browser` or `module` key as `mjs` force
251
+ // the use of this extension, so we need to tell webpack to fall back
252
+ // to auto mode (ES Module interop, allows ESM to import CommonJS).
253
+ test : / \. m j s $ / ,
254
+ include : / n o d e _ m o d u l e s / ,
255
+ type : 'javascript/auto' ,
256
+ } ,
247
257
{
248
258
// "oneOf" will traverse all following loaders until one will
249
259
// match the requirements. When no loader matches it will fall
You can’t perform that action at this time.
0 commit comments