[英]trees:{ mergetrees(['src',external js file])} in ember-cli-build.js is not working
In glimmer application, I want to bundle the external Js file with app.js file. 在glimmer应用程序中,我想将外部Js文件与app.js文件捆绑在一起。 I want to use svg in glimmer application.
我想在微光应用程序中使用svg。 Instead of ember-inline-svg,I used broccoli-flatiron and broccoli-merge-trees packages to bundle external js file with app.js.
我没有使用ember-inline-svg,而是使用broccoli-flatiron和broccoli-merge-trees软件包将外部js文件与app.js捆绑在一起。
My code in ember-cli-build.js is 我在ember-cli-build.js中的代码是
const GlimmerApp = require('@glimmer/application-pipeline').GlimmerApp;
const merge = require('merge');
const fs = require('fs');
const Funnel = require('broccoli-funnel');
const flatiron = require('broccoli-flatiron');
const mergeTree = require('broccoli-merge-trees');
module.exports = function(defaults) {
var options=merge(true, {}, {
paths: ['src/ui/styles/svgs']
});
var svgs = mergeTree(options.paths.filter(function(path) {
return fs.existsSync(path);
}));
svgs = new Funnel(svgs, {
include: [new RegExp(/\.svg$/)]
});
svgs = flatiron(svgs, {
outputFile: 'svgs.js',
trimExtensions: true,
variableName : "const svgs = "
});
let app = new GlimmerApp(defaults, {
trees:{
src:mergeTree(['src',svgs])
}
});
return app.toTree();
};
But it gives an error "The type of module 'svgs' could not be identified"... 但是它给出了错误“无法识别模块'svgs'的类型” ...
I want to bundle svgs with app.js. 我想将svgs与app.js捆绑在一起。
Try to merge the trees like this instead: 尝试像这样合并树:
…
module.exports = function(defaults) {
…
let app = new GlimmerApp(defaults, {
});
return mergeTree([app.toTree(), svgs]);
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.