We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
假设有以下目录,其中目录中的 .es6 文件,会被编译成 .js 文件输出。
.es6
.js
-- page -- index.html -- bootstrap.es6 -- main.js -- main1.es6 -- require.js
main.js 和 main1.es6 文件内容相同,如下:
main.js
main1.es6
require(['index.js'], function () {});
分别通过以下几个场景在 index.html 引入 require.js 文件
index.html
require.js
<!-- 场景1 --> <script data-main="main.js" src="require.js"></script> <!-- 场景2 --> <script data-main="main1.es6" src="require.js"></script> <!-- 场景3 --> <!-- 注意: __uri() 是使用了 fis3-parser-html-uri 插件,增强 fis 的资源定位能力。 在 fis 的 `parser` 阶段,它会将 __uri(main.es6) 替换成 /page/index/main1.js --> <script data-main="__uri(main1.es6)" src="require.js"></script>
在上面的三个场景中:
场景1
data-main
index_html_map.js
场景2
data-main="/page/index/main1.es6"
场景3
/page/index/main1.js
那么在 场景3下,无法生成 index_html_map.js 文件,是因为在产出前不存在 /page/index/main1.js 造成的嘛?
The text was updated successfully, but these errors were encountered:
场景3就不考虑了,原因如你所说。
场景2居然不正确?那个 data-main 应该是产出 module Id 还是 module path? 你手动改成 module path 就正确了?
Sorry, something went wrong.
场景2下生成的配置文件如下:
require.config({paths:{ "page/index/index.es6": "/page/index/index", "page/index/main1.es6": "/page/index/main1" }});
而实际加载 main1.es6 文件的路径却是 /page/index/mina1.es6.js
/page/index/mina1.es6.js
No branches or pull requests
假设有以下目录,其中目录中的
.es6
文件,会被编译成.js
文件输出。main.js
和main1.es6
文件内容相同,如下:分别通过以下几个场景在
index.html
引入require.js
文件在上面的三个场景中:
场景1
是正常的,data-main
会被替换为正确的地址,也会生成index_html_map.js
配置文件场景2
,由于data-main="/page/index/main1.es6"
,导致无法加载入口文件,但也算『符合预期』。它也会生成index_html_map.js
配置文件场景3
,无法生成index_html_map.js
配置文件,但其实发布后是存在/page/index/main1.js
文件的。那么在
场景3
下,无法生成index_html_map.js
文件,是因为在产出前不存在/page/index/main1.js
造成的嘛?The text was updated successfully, but these errors were encountered: