Switching to fusebox inferno build instead.

This commit is contained in:
Dessalines 2018-10-21 18:39:03 -07:00
parent 72451998b5
commit 3713a878e7
6 changed files with 743 additions and 2579 deletions

View File

@ -1,5 +1,5 @@
cd ../server/ui
yarn
yarn build:prod
yarn build
cd ../service
cargo run

53
server/ui/fuse.js Normal file
View File

@ -0,0 +1,53 @@
const {
FuseBox,
Sparky,
EnvPlugin,
CSSPlugin,
WebIndexPlugin,
QuantumPlugin,
} = require('fuse-box');
// const transformInferno = require('../../dist').default
const transformInferno = require('ts-transform-inferno').default;
const transformClasscat = require('ts-transform-classcat').default;
let fuse, app;
let isProduction = false;
Sparky.task('config', _ => {
fuse = new FuseBox({
homeDir: 'src',
hash: isProduction,
output: 'dist/$name.js',
experimentalFeatures: true,
cache: !isProduction,
sourceMaps: !isProduction,
transformers: {
before: [transformClasscat(), transformInferno()],
},
plugins: [
EnvPlugin({ NODE_ENV: isProduction ? 'production' : 'development' }),
CSSPlugin(),
WebIndexPlugin({
title: 'Inferno Typescript FuseBox Example',
template: 'src/index.html',
}),
isProduction &&
QuantumPlugin({
bakeApiIntoBundle: 'app',
treeshake: true,
uglify: true,
}),
],
});
app = fuse.bundle('app').instructions('>index.tsx');
});
Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
Sparky.task('env', _ => (isProduction = true));
Sparky.task('dev', ['clean', 'config'], _ => {
fuse.dev();
app.hmr().watch();
return fuse.run();
});
Sparky.task('prod', ['clean', 'env', 'config'], _ => {
// fuse.dev({ reload: true }); // remove after demo
return fuse.run();
});

View File

@ -4,27 +4,22 @@
"description": "A simple UI for Torrents.csv",
"main": "index.js",
"scripts": {
"build:dev": "webpack",
"build:prod": "webpack -p",
"start": "webpack-dev-server --inline"
"start": "node fuse dev",
"build": "node fuse prod"
},
"keywords": [],
"author": "Dominic Gannaway",
"license": "MIT",
"dependencies": {
"inferno": "^5.6.1",
"moment": "^2.22.2"
"inferno": "^6.0.3",
"moment": "^2.22.2",
"classcat": "^1.1.3"
},
"devDependencies": {
"classcat": "^3.0.0",
"clean-webpack-plugin": "^0.1.17",
"css-loader": "^1.0.0",
"html-webpack-plugin": "^2.30.1",
"style-loader": "^0.23.1",
"ts-loader": "^3.5.0",
"fuse-box": "^3.1.3",
"ts-transform-classcat": "^0.0.2",
"ts-transform-inferno": "^3.0.2",
"webpack": "^3.11.0",
"webpack-dev-server": "^2.9.5"
"typescript": "^2.7.1",
"uglify-es": "^3.3.9"
}
}

View File

@ -16,6 +16,7 @@
<body>
<div id="app"></div>
$bundles
</body>
</html>

View File

@ -1,57 +0,0 @@
const webpack = require('webpack');
const CleanWebpackPlugin = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
const transformInferno = require("ts-transform-inferno").default;
// const transformInferno = require('../../dist').default
const transformClasscat = require('ts-transform-classcat').default;
module.exports = {
entry: "./src/index.tsx",
output: {
path: path.resolve(__dirname, "dist/"),
filename: "bundle.js"
},
resolve: {
mainFields: ['main'], // Important so Webpack resolves the main field of package.json for Classcat
extensions: [".js", ".jsx", ".ts", ".tsx"]
},
module: {
rules: [
{
test: /\.tsx$/,
loader: "ts-loader",
options: {
getCustomTransformers: () => ({
before: [transformClasscat(), transformInferno()]
})
}
},
{
test: /\.ts$/,
loader: "ts-loader"
},
{ test: /\.css$/, loader: "style-loader!css-loader" }
]
},
devServer: {
contentBase: "src/",
historyApiFallback: true
},
plugins: [
new HtmlWebpackPlugin({
template: "./src/index.html",
inject: "body"
}),
new CleanWebpackPlugin(["dist"], {
verbose: true
}),
// By default, webpack does `n=>n` compilation with entry files. This concatenates
// them into a single chunk.
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1
}),
new webpack.HotModuleReplacementPlugin()
]
};

File diff suppressed because it is too large Load Diff