github.com/ngocphuongnb/tetua@v0.0.7-alpha/packages/editor/webpack.config.js (about)

     1  const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
     2  const { NormalModuleReplacementPlugin } = require("webpack");
     3  const CopyPlugin = require("copy-webpack-plugin");
     4  
     5  module.exports = {
     6    entry: "./src/index.ts",
     7    mode: "development",
     8    devtool: false,
     9    module: {
    10      // Use `ts-loader` on any file that ends in '.ts'
    11      rules: [
    12        {
    13          test: /\.ts$/,
    14          use: "ts-loader",
    15          exclude: /node_modules/,
    16        },
    17      ],
    18    },
    19    resolve: {
    20      extensions: [".ts", ".js"],
    21    },
    22    output: {
    23      filename: "editor.js",
    24      path: `${process.cwd()}/dist`,
    25    },
    26    optimization: {
    27      // minimize: true,
    28    },
    29    plugins: [
    30      new CopyPlugin({
    31        patterns: [
    32          { from: "./assets", to: "" },
    33        ],
    34      }),
    35      // new BundleAnalyzerPlugin({ openAnalyzer: false }),
    36      // new NormalModuleReplacementPlugin(
    37      //   /highlight\.js\/lib\/core/,
    38      //   __dirname + '/src/highlight.ts'
    39      // ),
    40    ],
    41    externals: {
    42      'highlight.js/lib/core': 'hljs',
    43      // 'highlight.js': 'hljs',
    44      // 'highlight.js/lib/languages/php': 'hljs.getLanguage(\'php\')',
    45      // 'highlight.js/lib/languages/typescript': 'hljs.getLanguage(\'typescript\')',
    46    },
    47  };