I've created this web app on codesandbox that prints some GeoJSON data on a map with Deck.gl. It has a webpack.config.js file and it's working fine... However, I'd like to know a way of compiling this application into a single js file, including the code that I've developed with its libraries included. I want to do that because with this js file I'd be able to embed this application inside a different app that uses only pure Javascript.
Basically, the webpack.config.js from the project is:
const CONFIG = {
mode: "development",
entry: {
app: "./app.js"
},
output: {
library: "App"
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules)/,
loader: "babel-loader",
options: {
presets: [
"@babel/preset-env",
"@babel/react",
{
plugins: ["@babel/plugin-proposal-class-properties"]
}
]
}
}
]
}
};
module.exports = (env) =>
env ? require("../../webpack.config.local")(CONFIG)(env) : CONFIG;
And its current package.json is:
{
"name": "deck-gl-point",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"start-local": "webpack-dev-server --env.local --progress --hot --open",
"start": "webpack-dev-server --progress --hot --open"
},
"dependencies": {
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",
"@deck.gl/aggregation-layers": "8.3.3",
"csvtojson": "2.0.10",
"global": "4.3.2",
"react-scripts": "2.1.8",
"deck.gl": "^8.6.0-alpha.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-map-gl": "^6.0.0"
},
"devDependencies": {
"@babel/core": "^7.4.0",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.5",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.1"
},
"keywords": [],
"description": ""
}
I know webpack is made for bundling projects in single files. But I don't know how to start modifying these files for generating a single js file for my project... Is it possible to do? What do I have to modify in order to bundle this project into a single file?