Files
redash/viz-lib/webpack.config.js
Eric Radman 1b1b9bd98d Import all Plotly visualizations (#6673)
- Accessible using the Custom chart type
- Disable 'fs' and 'path' modules which are available in node, but not
  on the frontend.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Guido Petri <18634426+guidopetri@users.noreply.github.com>
2024-01-07 20:19:58 +00:00

65 lines
1.4 KiB
JavaScript

const LessPluginAutoPrefix = require("less-plugin-autoprefix");
const path = require("path");
const isProduction = process.env.NODE_ENV === "production";
module.exports = {
mode: isProduction ? "production" : "development",
entry: "./src/index.ts",
output: {
path: path.resolve(__dirname, "dist"),
filename: "redash-visualizations.js",
libraryTarget: "umd",
assetModuleFilename: 'images/[name][ext]'
},
resolve: {
symlinks: false,
extensions: [".js", ".jsx", ".ts", ".tsx"],
fallback: {
fs: false,
path: false
}
},
module: {
rules: [
{
test: /\.[jt]sx?$/,
exclude: /node_modules/,
use: ["babel-loader"],
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
type: 'asset/resource',
},
{
test: /\.less$/,
use: [
"style-loader",
"css-loader",
{
loader: "less-loader",
options: {
lessOptions: {
plugins: [new LessPluginAutoPrefix({ browsers: ["last 3 versions"] })],
javascriptEnabled: true,
},
},
},
],
},
],
},
externals: [
{
lodash: "lodash",
react: "react",
"react-dom": "react-dom",
},
/^antd/i,
],
};