This repository was archived by the owner on Jun 20, 2023. It is now read-only.
This repository was archived by the owner on Jun 20, 2023. It is now read-only.
Closed
Description
Greetings,
I'm having an issue very similar to this one: #1133
In AngularJS (1.6.9) there is this piece of code:
[...]
function getControllers(directiveName, require, $element, elementControllers) {
var value;
if (isString(require)) {
var match = require.match(REQUIRE_PREFIX_REGEXP);
var name = require.substring(match[0].length);
[...]
Which doesn't get parse correctly when using quantum.
Error: ReferenceError: require is not defined
Converted code (without uglify):
function getControllers(directiveName, $fsx, $element, elementControllers) {
var value;
if (isString($fsx)) {
var match = require.match(REQUIRE_PREFIX_REGEXP);
var name = require.substring(match[0].length);
Reading the issue linked above i updated fusebox to 3.2.0-next10 but then something similar happened to another piece of code in AngularJS:
AngularJS code:
function getDirectiveRequire(directive) {
var require = directive.require || (directive.controller && directive.name);
if (!isArray(require) && isObject(require)) {
forEach(require, function(value, key) {
var match = value.match(REQUIRE_PREFIX_REGEXP);
var name = value.substring(match[0].length);
if (!name) require[key] = match[0] + key;
});
}
Error: TypeError: e.match is not a function
Converted code (without uglify):
function getDirectiveRequire(directive) {
var require = directive.require || directive.controller && directive.name;
if (!isArray($fsx) && isObject($fsx)) {
forEach($fsx, function (value, key) {
var match = value.match(REQUIRE_PREFIX_REGEXP);
var name = value.substring(match[0].length);
if (!name)
require[key] = match[0] + key;
});
}
return $fsx;
}
This is my quantum configuration (i have tried with any combination of replaceTypeOf and mangle, also completely disabling uglify, still not working)
this.isProduction && QuantumPlugin({
//bakeApiIntoBundle: "app",
replaceTypeOf: false,
treeshake: true,
uglify: {
mangle: true
},
css: {
clean: true
},
api: core => {
core.solveComputed("moment/moment.js", {
mapping: "moment/locale**",
fn: statement => {
statement.setExpression(`"moment/locale/" + name + ".js"`);
}
});
}
// containedAPI : true
})