Adds webpack for bundling

master
Atul R 5 years ago
parent bc3c601b59
commit 7bb082de23
  1. 2121
      package-lock.json
  2. 18
      package.json
  3. 5
      src/index.tsx
  4. 3
      tsconfig.json
  5. 31
      webpack.config.js

2121
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -6,18 +6,24 @@
"license": "MIT",
"private": true,
"scripts": {
"start:watch": "nodemon -e js,ts,tsx --ignore dist/ --ignore node_modules/ --exec yarn start",
"start": "tsc && qode ./dist/index.js"
"build": "webpack -p",
"start": "webpack && qode ./dist/index.js",
"debug": "webpack && qode --inspect ./dist/index.js"
},
"dependencies": {
"@nodegui/nodegui": "^0.1.3",
"@nodegui/react-nodegui": "^0.1.1",
"@nodegui/nodegui": "^0.1.5",
"@nodegui/react-nodegui": "^0.1.5",
"react": "^16.9.0"
},
"devDependencies": {
"nodemon": "latest",
"@types/node": "^12.6.8",
"@types/react": "^16.8.23",
"typescript": "^3.5.3"
"@types/node": "^12.6.8",
"file-loader": "^4.2.0",
"node-loader": "^0.6.0",
"ts-loader": "^6.0.4",
"typescript": "^3.5.3",
"webpack": "^4.39.2",
"webpack-cli": "^3.3.6"
}
}

@ -8,10 +8,10 @@ import {
useEventHandler
} from "@nodegui/react-nodegui";
import React, { useState } from "react";
import path from "path";
import { AspectRatioMode } from "@nodegui/nodegui";
//@ts-ignore
import imageUrl from "../assets/sample.jpg";
const imageUrl = path.resolve(__dirname, "../assets/sample.jpg");
const fixedSize = { width: 500, height: 500 };
const App = () => {
const [time, setTime] = useState(new Date());
@ -19,6 +19,7 @@ const App = () => {
{ clicked: () => setTime(new Date()) },
[]
);
console.log(imageUrl);
return (
<Window minSize={fixedSize} maxSize={fixedSize} styleSheet={styleSheet}>
<View id="container">

@ -12,5 +12,6 @@
"alwaysStrict": true,
"moduleResolution": "node",
"esModuleInterop": true
}
},
"include": ["**/*"]
}

@ -0,0 +1,31 @@
const path = require("path");
module.exports = {
mode: process.NODE_ENV || "development",
entry: "./src",
target: "node",
output: {
path: path.resolve(__dirname, "dist"),
filename: "index.js"
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/
},
{
test: /\.(png|jpe?g|gif|svg)$/i,
use: [{ loader: "file-loader" }]
},
{
test: /\.node/i,
use: [{ loader: "node-loader" }, { loader: "file-loader" }]
}
]
},
resolve: {
extensions: [".tsx", ".ts", ".js"]
}
};
Loading…
Cancel
Save