journey from helloworld-webpart to Fable
- Put the F# client into
src\Client
. - In your TypeScript webpart
*.ts
addimport { renderTodoApp } from "../../Client/out/react-component";
- In the same file change
public render(): void
to addid
to the enclosingdiv
and callrenderTodoApp
at the end - In
gulpfile.js
add
build.configureWebpack.mergeConfig({
additionalConfiguration: (generatedConfiguration) => {
generatedConfiguration.module.loaders.push([
{
test: /\.js$/,
//exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
}
]);
return generatedConfiguration;
}
});
before the last line build.initialize(gulp);
- in
package.json
and to dependecies
"fable-core": "^0.7.25",
"fable-powerpack": "^0.0.19",
"fable-react": "^0.8.0",
"fable-plugins-nunit": "^0.7.2",
"fable-import-d3": "^0.0.4",
"fable-import-pixi": "^0.0.10",
"fable-import-three": "^0.0.4",
and to devDependencies
"babel-core": "^6.23.1",
"babel-loader": "^6.3.2",
"babel-preset-es2015": "^6.22.0",
"fable-compiler": "^0.7.34",
"http-server": "^0.9.0",
"source-map-loader": "^0.1.5",
"webpack": "^2.2.1"
- in
tsconfig.json
add"allowJs": true,
and remove"declaration": true,
git clone the repo
npm i
npm i -g gulp
build
gulp
This package produces the following:
- lib/* - intermediate-stage commonjs build artifacts
- dist/* - the bundled script, along with other resources
- deploy/* - all resources which should be uploaded to a CDN.
gulp clean - TODO gulp test - TODO gulp serve - TODO gulp bundle - TODO gulp package-solution - TODO
In one console window
cd src\Client
fable --watch
In second console window
gulp serve