我test.fsx样子:编译寓言生成代码的WebPack
module Test
#r "./node_modules/fable-core/Fable.Core.dll"
open Fable.Core
open Fable.Import.Browser
type ItemCompletedData = {itemsCompleted:int}
type AddData = {text:string}
[<Pojo>]
type ActionData =
| ItemCompleted of ItemCompletedData
| Add of AddData
let test = (Add {text="hello world"})
console.log(test)
与编译:
node node_modules/fable-compiler/index.js --projFile test.fsx -o ./js/
webpack.config.js样子:
var path = require("path");
module.exports = {
entry: {
main: ["./js/test.js"]
},
output: {
path: path.resolve(__dirname, "build"),
publicPath: ".",
filename: "[name].js"
}
,devServer: {
contentBase: path.join(__dirname, "./"),
compress: true,
port: 9000
}
};
运行使用以下命令的webpack:
node node_modules/webpack/bin/webpack.js --devtool source-map
这将会给warnigns:在./~/[email protected]/umd/Symbol.js 3
警告:24-31关键 依赖:要求功能的使用方式,其中依赖关系 不能静态提取
警告在./~/[email protected]/umd/Util.js 3:24-31临界 依赖性:要求功能的方式用于依赖关系 无法静态提取
当打开使用main.js我在控制台得到一个错误的HTML文件:
Symbol.js:3 Uncaught Error: Cannot find module "."
的symbol.js来自fable-core/umd/Symbol
(传说中生成的脚本)。当我手动将其更改为:fable-core/Symbol
(对于所有的寓言核心依赖项),那么我可以在没有警告的情况下编译webpack,并且不会在页面中出现错误。
如何避免此错误而无需手动更改寓言输出?