Skip to content

webpack externals not working with tests #8086

Closed

Description

@darkbasic

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.4.7 (e)
node: 8.7.0
os: linux x64
@angular/animations: 4.4.5
@angular/common: 4.4.5
@angular/compiler: 4.4.5
@angular/core: 4.4.5
@angular/forms: 4.4.5
@angular/http: 4.4.5
@angular/platform-browser: 4.4.5
@angular/platform-browser-dynamic: 4.4.5
@angular/router: 4.4.5
@angular/cli: 1.4.7
@angular/compiler-cli: 4.4.5
@angular/language-service: 4.4.5
typescript: 2.3.4
typescript-extends: 1.0.1

Repro steps.

git clone https://github.com/darkbasic/angularcli-meteor.git
cd angularcli-meteor
npm install
Install Meteor: https://www.meteor.com/install
./node_modules/.bin/meteor-client bundle -s api
npm run test

The log given by the failure.

Chrome 62.0.3202 (Linux 0.0.0) ERROR
  Uncaught ReferenceError: Mongo is not defined
  at http://localhost:9876/_karma_webpack_/vendor.bundle.js:354

Desired functionality.

Mention any other details that might be useful.

Hi,
I'm working to integrate angular-cli with meteor-client-bundler: https://github.com/darkbasic/angularcli-meteor
For the moment I'm simply ejecting the config, even if I would love to get to a solution which does not require to do so in the future.

Basically I'm using Webpack externals to resolve the meteor namespace.

import { Mongo } from 'meteor/mongo';

The reason why I'm doing this is because we use our own custom bundler rather than relying on Meteor's bundler, where this logic already exists.

https://github.com/darkbasic/angularcli-meteor/blob/master/patches/webpack.config.js.patch
https://github.com/darkbasic/angularcli-meteor/blob/master/webpack.config.js.dev

Everything works flowlessly when I run npm run start, but unfortunately I get

Uncaught ReferenceError: Mongo is not defined

when trying to run tests. Is the module resolution different for tests? How can I solve this?

Thanks

Activity

  1. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    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.

  2. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions