Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required namespace never defined with goog.requireType #140

Closed
schmidtk opened this issue Sep 1, 2020 · 1 comment · Fixed by #142
Closed

Required namespace never defined with goog.requireType #140

schmidtk opened this issue Sep 1, 2020 · 1 comment · Fixed by #142

Comments

@schmidtk
Copy link
Contributor

schmidtk commented Sep 1, 2020

Files that are only referenced by goog.requireType are included in the depswriter.py output, but not included in the build because they are not an explicit dependency.

This can be reproduced with the mixed-modules demo by making the following changes:

goog-requiretype.js:

goog.provide('app.googRequireType');

/**
 * @typedef {string}
 */
app.googRequireType;

goog-require.js:

goog.provide('app.googRequire');
goog.requireType('app.googRequireType');

/**
 * @return {app.googRequireType}
 */
app.googRequire = function() {
  return 'from goog.require';
};

Current workaround is to goog.require the file somewhere, but it would be helpful if these could be automatically included in the build by some means.

schmidtk pushed a commit to schmidtk/closure-webpack-plugin that referenced this issue Sep 4, 2020
schmidtk pushed a commit to schmidtk/closure-webpack-plugin that referenced this issue Sep 15, 2020
schmidtk pushed a commit to schmidtk/closure-webpack-plugin that referenced this issue Sep 21, 2020
@zhamidi
Copy link

zhamidi commented Nov 23, 2020

I get the same error message in my project but I do not know if the cause is the same.
I transpiled my TS project using tsickle and this is the entry file I give to webpack:

goog.module('webmodule.AsklibWebModule');
var module = module || { id: 'webmodule/AsklibWebModule.ts' };
exports.ColorFactory = exports.TYPE_KINDS = exports.NODE_KINDS = exports.avisitor = exports.visitor = exports.logger = exports.factory = void 0;
const tsickle_AsklibEngineFactory_1 = goog.requireType("asklib.AsklibEngineFactory");
const tsickle_Asklog_2 = goog.requireType("asklib.commons.Asklog");
const tsickle_ColorFactory_3 = goog.requireType("asklib.commons.ColorFactory");
const tsickle_AbstractRequestVisitor_4 = goog.requireType("asklib.tree.AbstractRequestVisitor");
const tsickle_RequestNodeKind_5 = goog.requireType("asklib.tree.nodes.RequestNodeKind");
const tsickle_DefaultRequestVisitor_6 = goog.requireType("asklib.tree.visitors.DefaultRequestVisitor");
const tsickle_SimpleType_7 = goog.requireType("asklib.types.SimpleType");
var AsklibEngineFactory_1 = goog.require('asklib.AsklibEngineFactory');
Object.defineProperty(exports, "factory", { enumerable: true, get: function () { return AsklibEngineFactory_1.AsklibEngineFactory; } });
var Asklog_1 = goog.require('asklib.commons.Asklog');
Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return Asklog_1.Asklog; } });
var ColorFactory_1 = goog.require('asklib.commons.ColorFactory');
Object.defineProperty(exports, "ColorFactory", { enumerable: true, get: function () { return ColorFactory_1.ColorFactory; } });
var AbstractRequestVisitor_1 = goog.require('asklib.tree.AbstractRequestVisitor');
Object.defineProperty(exports, "avisitor", { enumerable: true, get: function () { return AbstractRequestVisitor_1.AbstractRequestVisitor; } });
var RequestNodeKind_1 = goog.require('asklib.tree.nodes.RequestNodeKind');
Object.defineProperty(exports, "NODE_KINDS", { enumerable: true, get: function () { return RequestNodeKind_1.RequestNodeKind; } });
var DefaultRequestVisitor_1 = goog.require('asklib.tree.visitors.DefaultRequestVisitor');
Object.defineProperty(exports, "visitor", { enumerable: true, get: function () { return DefaultRequestVisitor_1.DefaultRequestVisitor; } });
var SimpleType_1 = goog.require('asklib.types.SimpleType');
Object.defineProperty(exports, "TYPE_KINDS", { enumerable: true, get: function () { return SimpleType_1.SimpleType; } });

I get a Required namespace "XXX" never definedwith both the goog.require and goog.requireType declarations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants