You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ng6 - Can't reexport the named export 'graphql' from non EcmaScript module #10744
import { graphql } from 'graphql';
...
export class AppModule {
constructor() {
// it does not matter what it is below as long as we're using something from `graphql`
const t = graphql();
}
}
npm start
Observed behavior
ERROR in ./node_modules/graphql/index.mjs
2:0-49 Can't reexport the named export 'graphql' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/graphql/index.mjs
2:0-49 Can't reexport the named export 'graphqlSync' from non EcmaScript module (only default export is available)
...
// continues reporting the same error for all .mjs files
Desired behavior
Build should work
Mention any other details that might be useful (optional)
For real world applications using graphql, this is a critical regression.
Tried a few workarounds- forking and optimistically editing @angular-devkit; using fileReplacements for graphql.mjs; specifying exact imports (from 'graphql -> from 'graphql/utilities/index.js').
None worked. This is the only issue blocking Angular@6 migration for us
I upgraded to the freshly released @angular-devkit/build-angular 6.0.2 and graphql 0.13.2. It now compile fine, but running tests will fail. Karma will open Chrome with the Karma page, but nothing happens at all. When clicking on the "DEBUG" button, it will open a new tab and after a short while the following error will appear in Chrome console:
Uncaught ReferenceError: require is not defined
at Object../node_modules/graphql/jsutils/instanceOf.mjs (_karma_webpack_/vendor.js:147419)
at __webpack_require__ (_karma_webpack_/webpack:/webpack/bootstrap:76)
at Object../node_modules/graphql/type/definition.mjs (_karma_webpack_/vendor.js:151430)
at __webpack_require__ (_karma_webpack_/webpack:/webpack/bootstrap:76)
at Object../node_modules/graphql/type/validate.mjs (_karma_webpack_/vendor.js:153476)
at __webpack_require__ (_karma_webpack_/webpack:/webpack/bootstrap:76)
at Object../node_modules/graphql/graphql.mjs (_karma_webpack_/vendor.js:146834)
at __webpack_require__ (_karma_webpack_/webpack:/webpack/bootstrap:76)
at Object../node_modules/graphql/index.mjs (_karma_webpack_/vendor.js:146954)
at __webpack_require__ (_karma_webpack_/webpack:/webpack/bootstrap:76)
./node_modules/graphql/jsutils/instanceOf.mjs @ _karma_webpack_/vendor.js:147419
__webpack_require__ @ _karma_webpack_/main.js:77
./node_modules/graphql/type/definition.mjs @ _karma_webpack_/vendor.js:151430
__webpack_require__ @ _karma_webpack_/main.js:77
./node_modules/graphql/type/validate.mjs @ _karma_webpack_/vendor.js:153476
__webpack_require__ @ _karma_webpack_/main.js:77
./node_modules/graphql/graphql.mjs @ _karma_webpack_/vendor.js:146834
__webpack_require__ @ _karma_webpack_/main.js:77
./node_modules/graphql/index.mjs @ _karma_webpack_/vendor.js:146954
__webpack_require__ @ _karma_webpack_/main.js:77
./node_modules/apollo-link-schema/lib/schemaLink.js @ _karma_webpack_/vendor.js:138024
__webpack_require__ @ _karma_webpack_/main.js:77
./node_modules/apollo-link-schema/lib/index.js @ _karma_webpack_/vendor.js:138005
__webpack_require__ @ _karma_webpack_/main.js:77
./src/app/shared/testing/MockApolloProvider.ts @ _karma_webpack_/main.js:165373
__webpack_require__ @ _karma_webpack_/main.js:77
./src/app/actions/services/action.service.spec.ts @ _karma_webpack_/main.js:150776
__webpack_require__ @ _karma_webpack_/main.js:77
webpackContext @ _karma_webpack_/main.js:150478
./src/test.ts @ _karma_webpack_/main.js:166801
__webpack_require__ @ _karma_webpack_/main.js:77
checkDeferredModules @ _karma_webpack_/main.js:44
./Data/tmp/schema/index.ts.Object.defineProperty.value @ _karma_webpack_/main.js:135
(anonymous) @ _karma_webpack_/main.js:138
So it seems it is quite solved yet. Downgrading back graphql with yarn add graphql@0.13.0 (but keeping @angular-devkit/build-angular 6.0.2, will make tests pass.
Should work when next version after graphql@0.13.2 is released (at least for me) (next version planned is graphql@14.0.0 which seems to be a big release that will take some time)--you can also install unreleased version https://github.com/graphql/graphql-js#want-to-ride-the-bleeding-edge.
Activity
amitport commentedon May 13, 2018
For real world applications using graphql, this is a critical regression.
Tried a few workarounds- forking and optimistically editing
@angular-devkit; usingfileReplacementsfor graphql.mjs; specifying exact imports (from 'graphql->from 'graphql/utilities/index.js').None worked. This is the only issue blocking Angular@6 migration for us
support mjs extension
fix(@angular-devkit/build-angular): support mjs extension
fix(@angular-devkit/build-angular): support mjs extension
amitport commentedon May 15, 2018
@elmoGrummelig
fixed for me by angular/devkit@ddf7edd
(need to wait for the tests to pass and a release of
@angular-devkit/build-angular)fix(@angular-devkit/build-angular): support mjs extension
PowerKiKi commentedon May 17, 2018
I upgraded to the freshly released
@angular-devkit/build-angular6.0.2 andgraphql0.13.2. It now compile fine, but running tests will fail. Karma will open Chrome with the Karma page, but nothing happens at all. When clicking on the "DEBUG" button, it will open a new tab and after a short while the following error will appear in Chrome console:So it seems it is quite solved yet. Downgrading back graphql with
yarn add graphql@0.13.0(but keeping@angular-devkit/build-angular6.0.2, will make tests pass.amitport commentedon May 17, 2018
Should work when next version after
graphql@0.13.2is released (at least for me) (next version planned isgraphql@14.0.0which seems to be a big release that will take some time)--you can also install unreleased version https://github.com/graphql/graphql-js#want-to-ride-the-bleeding-edge.see graphql/graphql-js#1344 (comment)
@PowerKiKi you need
@angular-devkit/build-angular@0.6.3on the angular sidefix(@angular-devkit/build-angular): support mjs extension
amitport commentedon Jun 27, 2018
Works with
graphql@14.0.0-rc.2and@angular-devkit/build-angular@0.6.3. Issue can be closed IMO. @DmitryEfimenkoangular-automatic-lock-bot commentedon Sep 8, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.