gpt4 book ai didi

grails - babel-asset-pipeline 1.3.1无法正常工作?

转载 作者:行者123 更新时间:2023-12-02 14:30:37 24 4
gpt4 key购买 nike

我一辈子都无法让这个 Assets 管道正常工作。

我补充说:

compile ":babel-asset-pipeline:1.3.1"

到我的BuildConfig.groovy

和:
grails.asset.babel.enabled = true
grails.asset.babel.processJsFiles = true

到我的Config.groovy

在我的application.js中,我只有:
// This is a manifest file that'll be compiled into application.js.
//
// Any JavaScript file within this directory can be referenced here using a relative path.
//
// You're free to add application-wide JavaScript to this file, but it's generally better
// to create separate JavaScript files as needed.
//
//= require jquery
//= require_tree .
//= require_self

if (typeof jQuery !== 'undefined') {
(function($) {
$('#spinner').ajaxStart(function() {
$(this).fadeIn();
}).ajaxStop(function() {
$(this).fadeOut();
});
})(jQuery);
}

class Test {
render() {
return (
"TEST"
);
}
}

应将其转换为:
// This is a manifest file that'll be compiled into application.js.
//
// Any JavaScript file within this directory can be referenced here using a relative path.
//
// You're free to add application-wide JavaScript to this file, but it's generally better
// to create separate JavaScript files as needed.
//
//= require jquery
//= require_tree .
//= require_self

'use strict';

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

if (typeof jQuery !== 'undefined') {
(function ($) {
$('#spinner').ajaxStart(function () {
$(this).fadeIn();
}).ajaxStop(function () {
$(this).fadeOut();
});
})(jQuery);
}

var Test = (function () {
function Test() {
_classCallCheck(this, Test);
}

_createClass(Test, [{
key: 'render',
value: function render() {
return "TEST";
}
}]);

return Test;
})();

根据此在线工具 https://babeljs.io/repl/

但是似乎我的application.js从未被处理过。怎么了?

最佳答案

我刚刚合并了关于该问题的请求请求。
实际上,文档是错误的。 Assets 配置的 namespace 不是grails.asset而是grails.asset s

因此,如果您将配置更新为

grails.assets.babel.enabled = true
grails.assets.babel.processJsFiles = true

它应该工作

关于grails - babel-asset-pipeline 1.3.1无法正常工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33013361/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com