mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-21 06:53:17 +08:00
7aeb60f42a
* develop: (50 commits) Typo fix Fix repo URL Revert flowchart change Revert flowchart change Fix TODO Qs chore(deps-dev): bump @commitlint/cli from 17.1.1 to 17.1.2 chore(deps-dev): bump terser-webpack-plugin from 5.3.5 to 5.3.6 chore(deps-dev): bump webpack-dev-server from 4.10.0 to 4.10.1 Fix gitGraph findLane function error Update dependabot.yml Replacing replaceAll with replace Rework 'parseDuration' as a pure duration parsing Supports duration in decimal Create a more consistent 'parseDuration' Remove `@ts-ignore`s. Fix svgDraw return types ...
72 lines
1.7 KiB
JavaScript
72 lines
1.7 KiB
JavaScript
import path from 'path';
|
|
// const esbuild = require('esbuild');
|
|
const { ESBuildMinifyPlugin } = require('esbuild-loader');
|
|
export const resolveRoot = (...relativePath) => path.resolve(__dirname, '..', ...relativePath);
|
|
|
|
export default {
|
|
amd: false, // https://github.com/lodash/lodash/issues/3052
|
|
target: 'web',
|
|
entry: {
|
|
mermaid: './src/mermaid',
|
|
},
|
|
resolve: {
|
|
extensions: ['.wasm', '.mjs', '.js', '.ts', '.json', '.jison'],
|
|
fallback: {
|
|
fs: false, // jison generated code requires 'fs'
|
|
path: require.resolve('path-browserify'),
|
|
},
|
|
},
|
|
output: {
|
|
path: resolveRoot('./dist'),
|
|
filename: '[name].js',
|
|
library: {
|
|
name: 'mermaid',
|
|
type: 'umd',
|
|
export: 'default',
|
|
},
|
|
globalObject: 'typeof self !== "undefined" ? self : this',
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.ts$/,
|
|
use: 'ts-loader',
|
|
exclude: /node_modules/,
|
|
},
|
|
{
|
|
test: /\.js$/,
|
|
include: [resolveRoot('./src'), resolveRoot('./node_modules/dagre-d3-renderer/lib')],
|
|
use: {
|
|
loader: 'esbuild-loader',
|
|
options: {
|
|
// implementation: esbuild,
|
|
target: 'es2015',
|
|
},
|
|
},
|
|
},
|
|
{
|
|
// load scss to string
|
|
test: /\.scss$/,
|
|
use: ['css-to-string-loader', 'css-loader', 'sass-loader'],
|
|
},
|
|
{
|
|
test: /\.jison$/,
|
|
use: {
|
|
loader: path.resolve(__dirname, './loaders/jison.js'),
|
|
options: {
|
|
'token-stack': true,
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
devtool: 'source-map',
|
|
optimization: {
|
|
minimizer: [
|
|
new ESBuildMinifyPlugin({
|
|
target: 'es2015',
|
|
}),
|
|
],
|
|
},
|
|
};
|