mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
The config file format for webpack has changed slightly, so webpack was throwing this error: Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. This commit updates the config file format so webpack works again.
61 lines
1.3 KiB
JavaScript
61 lines
1.3 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"],
|
|
},
|
|
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,
|
|
],
|
|
};
|