Created
October 27, 2022 15:38
-
-
Save revanth0212/9ada164bd9b64ab7dbf8ecf1a4756f4e to your computer and use it in GitHub Desktop.
Webpack config to build mesh config artifacts into single JS file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require("path"); | |
const webpack = require("webpack"); | |
const entry = "./src/actions/mesh/handler.js"; | |
module.exports = { | |
entry, | |
target: "node", | |
output: { | |
library: { | |
type: "commonjs", | |
}, | |
path: path.resolve(__dirname, "actions", "mesh"), | |
filename: "handler.js", | |
}, | |
resolve: { | |
extensions: [".ts", ".js", ".json", ".mjs", ".graphql"], | |
}, | |
plugins: [ | |
new webpack.optimize.LimitChunkCountPlugin({ | |
maxChunks: 1, | |
}), | |
], | |
module: { | |
rules: [ | |
{ test: /\.js$/, use: "babel-loader" }, | |
{ | |
test: /\.ya?ml$/, | |
type: "json", | |
use: "yaml-loader", | |
}, | |
{ | |
test: /\.html$/i, | |
loader: "html-loader", | |
}, | |
{ | |
test: /\.ts?$/, | |
use: "ts-loader", | |
exclude: /node_modules/, | |
}, | |
{ | |
test: /\.m?js/, | |
resolve: { | |
fullySpecified: false, | |
}, | |
}, | |
{ | |
test: /\.(graphql|gql)$/, | |
exclude: /node_modules/, | |
loader: "graphql-tag/loader", | |
}, | |
], | |
}, | |
mode: process.env.NODE_ENV || "production", | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment