Skip to content
Snippets Groups Projects
  • Braden Shepherdson's avatar
    4580eab9
    [metabase-lib] Dev experience and CLJC infra improvements · 4580eab9
    Braden Shepherdson authored
    Dev experience:
    - CLJS now has source maps
    - Devtools extension renders CLJS data in Chrome (et al) Devtools
    - Use a debug build of CLJS in the tests
    - Fixed line numbers and breakpoints being off-by-one in Devtools
    
    CLJC infra:
    - More robust direct approach to JS<->CLJS conversions, powered by
      Malli transformers.
    - Powerful `define-getters-and-setters` macro to generate the accessors.
    4580eab9
    History
    [metabase-lib] Dev experience and CLJC infra improvements
    Braden Shepherdson authored
    Dev experience:
    - CLJS now has source maps
    - Devtools extension renders CLJS data in Chrome (et al) Devtools
    - Use a debug build of CLJS in the tests
    - Fixed line numbers and breakpoints being off-by-one in Devtools
    
    CLJC infra:
    - More robust direct approach to JS<->CLJS conversions, powered by
      Malli transformers.
    - Powerful `define-getters-and-setters` macro to generate the accessors.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
webpack.static-viz.config.js 1.29 KiB
const SRC_PATH = __dirname + "/frontend/src/metabase";
const BUILD_PATH = __dirname + "/resources/frontend_client";
const CLJS_SRC_PATH = __dirname + "/frontend/src/cljs_release";
const LIB_SRC_PATH = __dirname + "/frontend/src/metabase-lib";

const BABEL_CONFIG = {
  cacheDirectory: process.env.BABEL_DISABLE_CACHE ? null : ".babel_cache",
};

module.exports = env => {
  const shouldDisableMinimization = env.WEBPACK_WATCH === true;

  return {
    mode: "production",
    context: SRC_PATH,

    performance: {
      hints: false,
    },

    entry: {
      "lib-static-viz": {
        import: "./static-viz/index.js",
        library: {
          name: "StaticViz",
          type: "var",
        },
      },
    },

    output: {
      path: BUILD_PATH + "/app/dist",
      filename: "[name].bundle.js",
    },

    module: {
      rules: [
        {
          test: /\.(tsx?|jsx?)$/,
          exclude: /node_modules|cljs/,
          use: [{ loader: "babel-loader", options: BABEL_CONFIG }],
        },
      ],
    },
    resolve: {
      extensions: [".webpack.js", ".web.js", ".js", ".jsx", ".ts", ".tsx"],
      alias: {
        metabase: SRC_PATH,
        cljs: CLJS_SRC_PATH,
        "metabase-lib": LIB_SRC_PATH,
      },
    },
    optimization: {
      minimize: !shouldDisableMinimization,
    },
  };
};