Removing babel, upgrading inferno typescript build.

This commit is contained in:
Dessalines 2018-10-21 18:08:05 -07:00
parent 184fef4401
commit 72451998b5
6 changed files with 92 additions and 766 deletions

View File

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

View File

@ -1,12 +0,0 @@
{
"compact": false,
"presets": [
["es2015", {"loose": true, "modules": false}]
],
"plugins": [
"transform-class-properties",
"transform-object-rest-spread",
"babel-plugin-syntax-jsx",
["babel-plugin-inferno", {"imports": true}]
]
}

View File

@ -4,9 +4,8 @@
"description": "A simple UI for Torrents.csv", "description": "A simple UI for Torrents.csv",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "build:dev": "webpack",
"build": "webpack -p --display verbose", "build:prod": "webpack -p",
"lint": "tslint src/*.ts{,x} src/**/*.ts{,x}",
"start": "webpack-dev-server --inline" "start": "webpack-dev-server --inline"
}, },
"keywords": [], "keywords": [],
@ -17,22 +16,15 @@
"moment": "^2.22.2" "moment": "^2.22.2"
}, },
"devDependencies": { "devDependencies": {
"babel-core": "^6.26.0", "classcat": "^3.0.0",
"babel-loader": "^7.1.2", "clean-webpack-plugin": "^0.1.17",
"babel-plugin-inferno": "^5.1.0",
"babel-plugin-syntax-object-rest-spread": "^6.13.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"clean-webpack-plugin": "^0.1.18",
"css-loader": "^1.0.0", "css-loader": "^1.0.0",
"html-webpack-plugin": "^2.30.1", "html-webpack-plugin": "^2.30.1",
"source-map-loader": "^0.2.3",
"style-loader": "^0.23.1", "style-loader": "^0.23.1",
"ts-loader": "^3.5.0", "ts-loader": "^3.5.0",
"tslint": "^5.9.1", "ts-transform-classcat": "^0.0.2",
"typescript": "^3.1.3", "ts-transform-inferno": "^3.0.2",
"webpack": "3.11.0", "webpack": "^3.11.0",
"webpack-dev-server": "2.11.1" "webpack-dev-server": "^2.9.5"
} }
} }

View File

@ -1,7 +1,6 @@
{ {
"version": "2.2.2",
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "es5",
"module": "es6", "module": "es6",
"allowJs": false, "allowJs": false,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,

View File

@ -1,31 +1,38 @@
const webpack = require('webpack'); const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin'); const CleanWebpackPlugin = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require('html-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 = { module.exports = {
entry: "./src/index.tsx", // Point to main file entry: "./src/index.tsx",
output: { output: {
path: __dirname + "/dist", path: path.resolve(__dirname, "dist/"),
filename: "bundle.js" filename: "bundle.js"
}, },
resolve: { resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'] mainFields: ['main'], // Important so Webpack resolves the main field of package.json for Classcat
}, extensions: [".js", ".jsx", ".ts", ".tsx"]
performance: {
hints: false
}, },
module: { module: {
loaders: [ rules: [
{ {
test: /\.tsx?$/, // All ts and tsx files will be process by test: /\.tsx$/,
loaders: ['babel-loader', 'ts-loader'], // first babel-loader, then ts-loader loader: "ts-loader",
exclude: /node_modules/ // ignore node_modules options: {
}, { getCustomTransformers: () => ({
test: /\.jsx?$/, // all js and jsx files will be processed by before: [transformClasscat(), transformInferno()]
loader: 'babel-loader', // babel-loader })
exclude: /node_modules/ // ignore node_modules }
}, },
{ test: /\.css$/, loader: "style-loader!css-loader" }, {
test: /\.ts$/,
loader: "ts-loader"
},
{ test: /\.css$/, loader: "style-loader!css-loader" }
] ]
}, },
devServer: { devServer: {
@ -33,18 +40,18 @@ module.exports = {
historyApiFallback: true historyApiFallback: true
}, },
plugins: [ plugins: [
new HtmlWebpackPlugin( new HtmlWebpackPlugin({
{
template: "./src/index.html", template: "./src/index.html",
inject: "body" inject: "body"
} }),
), new CleanWebpackPlugin(["dist"], {
new CleanWebpackPlugin(
["dist"], {
verbose: true verbose: true
} }),
), // By default, webpack does `n=>n` compilation with entry files. This concatenates
new webpack.HotModuleReplacementPlugin(), // them into a single chunk.
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en-gb/) new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1
}),
new webpack.HotModuleReplacementPlugin()
] ]
}; };

File diff suppressed because it is too large Load Diff