2

硫化 1.14.7

我正在尝试在项目中使用 paper-dropdown-menu。在导入到我的 index.html 中的 components.html 文件上使用 vulcanize。Vulcanize 可以正确连接除 web-animations.js 文件之外的所有适当文件。我在浏览器控制台中收到以下错误。

http://localhost:9005/bower_components/web-animations-js/web-        animations-next-lite.min.js 
Failed to load resource: the server responded with a status of 404 (Not Found)

此错误源于硫化文件。

<script src="../../bower_components/web-animations-js/web-animations-next-lite.min.js"></script>

就在不透明动画的定义之上

Polymer({

is: 'opaque-animation',

我正在使用以下配置对 gulp 进行硫化

gulp.task('web_components', () =>
 gulp.src(config.paths.webComponentIndex)
  .pipe(vulcanize({
    abspath: config.paths.dist,
    excludes: [],
    inlineScripts: true,
    stripExcludes: false
  }))
  .pipe(gulp.dest(config.paths.dist))
);

config.paths.dist 是我的 dist 目录,webComponentIndex 当然是捆绑的输出文件,它可以正确捆绑除此动画文件之外的所有内容。如果我正确理解了这个过程,那么该 animations.js 文件应该与其他所有内容一起连接,但它没有这样做。

4

1 回答 1

0

我有同样的问题并解决了它。

这个问题发生在硫化包括bower_components\neon-animation\web-animations.html

并且web-animations.html只包含一个标签:

<script src="../web-animations-js/web-animations-next-lite.min.js"></script>

inlineScripts当您从 js 运行它或执行命令时,您所需要的只是将参数放入您的 vulcanize--inline-scripts

此选项将脚本标记替换为 js 文件内容。它有助于将外部资源包含到捆绑包中。

您确定在 bower_components 中有 web-animations-js 文件夹吗?

于 2017-02-02T06:56:35.440 回答