roman01la / webpack-closure-compiler

[DEPRECATED] Google Closure Compiler plugin for Webpack
MIT License
464 stars 25 forks source link

ERROR: Closure dependency methods must be called at file scope #15

Closed KainHaart closed 6 years ago

KainHaart commented 8 years ago

Trying on sample file

goog.provide('temp.Main');
goog.require('temp.Human');

/**
 * @constructor
 */
temp.Main = function() {
    this.human = new temp.Human();
};

/**
 * @return {string}
 */
temp.Main.prototype.hello = function() {
    return 'Hello ' + this.human.getName();
};

Got an error:

Caught error: [Error: temp.js from Closure Compiler The compiler is waiting for input via stdin. stdin:47: ERROR - Closure dependency methods(goog.provide, goog.require, etc) must be called at file scope. goog.provide('temp.Main'); ^

stdin:48: ERROR - Closure dependency methods(goog.provide, goog.require, etc) must be called at file scope. goog.require('temp.Human'); ^

2 error(s), 0 warning(s)

roman01la commented 7 years ago

@KainHaart Sorry, I'm not familiar much with Closure Modules and how Closure Compiler process them. I'd appreciate help here.

roman01la commented 6 years ago

closing due to no activity

orenmizr commented 6 years ago

@KainHaart can you tell us if you solved it ?

KainHaart commented 6 years ago

@orenmizr Sorry, i just tried this library and gave up. Now working on slightly different stack, not intended to solve this issue