Support Webpack
This commit is contained in:
parent
8b313fabb9
commit
81d9a0225e
|
@ -2,3 +2,4 @@
|
||||||
*.txt
|
*.txt
|
||||||
dist/
|
dist/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
out/
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
|
@ -1,13 +1,16 @@
|
||||||
{
|
{
|
||||||
"name": "socialvoid-deno",
|
"name": "my-webpack-project",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Node.js, Deno & browser Socialvoid client.",
|
"description": "My webpack project",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
"example": "examples"
|
"example": "examples"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "deno2node tsconfig.json"
|
"build": "webpack --mode=production --node-env=production",
|
||||||
|
"build:dev": "webpack --mode=development",
|
||||||
|
"build:prod": "webpack --mode=production --node-env=production",
|
||||||
|
"watch": "webpack --watch"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -26,7 +29,12 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node-fetch": "^2.5.12",
|
"@types/node-fetch": "^2.5.12",
|
||||||
|
"@webpack-cli/generators": "^2.4.0",
|
||||||
|
"crypto-browserify": "^3.12.0",
|
||||||
"deno2node": "^1.0.0",
|
"deno2node": "^1.0.0",
|
||||||
"typescript": "^4.4.3"
|
"stream-browserify": "^3.0.0",
|
||||||
|
"typescript": "^4.4.3",
|
||||||
|
"webpack": "^5.58.1",
|
||||||
|
"webpack-cli": "^4.9.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
// Generated using webpack-cli https://github.com/webpack/webpack-cli
|
||||||
|
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
const isProduction = process.env.NODE_ENV == "production";
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
target: "web",
|
||||||
|
entry: "./dist/mod.js",
|
||||||
|
output: {
|
||||||
|
library: "socialvoid",
|
||||||
|
filename: "socialvoid.js",
|
||||||
|
path: path.resolve(__dirname, "out"),
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: [".tsx", ".ts", ".js"],
|
||||||
|
fallback: {
|
||||||
|
fs: false,
|
||||||
|
crypto: require.resolve("crypto-browserify"),
|
||||||
|
stream: require.resolve("stream-browserify"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
if (isProduction) {
|
||||||
|
config.mode = "production";
|
||||||
|
} else {
|
||||||
|
config.mode = "development";
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
};
|
Loading…
Reference in New Issue