mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
73 lines
1.3 KiB
JavaScript
73 lines
1.3 KiB
JavaScript
const path = require('path')
|
|
|
|
const jsRule = {
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader'
|
|
}
|
|
}
|
|
|
|
const jisonRule = {
|
|
test: /\.jison$/,
|
|
use: {
|
|
loader: path.resolve(__dirname, './jisonLoader'),
|
|
options: {
|
|
'token-stack': true
|
|
}
|
|
}
|
|
}
|
|
|
|
const amdRule = {
|
|
parser: {
|
|
amd: false // https://github.com/lodash/lodash/issues/3052
|
|
}
|
|
}
|
|
const scssRule = {
|
|
// load scss to string
|
|
test: /\.scss$/,
|
|
use: [
|
|
{ loader: 'css-to-string-loader' },
|
|
{ loader: 'css-loader' },
|
|
{ loader: 'sass-loader' }
|
|
]
|
|
}
|
|
|
|
module.exports = {
|
|
mode: 'development',
|
|
target: 'web',
|
|
entry: {
|
|
mermaid: './src/mermaid.js',
|
|
e2e: './e2e/platform/viewer.js',
|
|
'bundle-test': './e2e/platform/bundle-test.js'
|
|
},
|
|
resolve: {
|
|
extensions: ['.wasm', '.mjs', '.js', '.json', '.jison']
|
|
},
|
|
node: {
|
|
fs: 'empty' // jison generated code requires 'fs'
|
|
},
|
|
output: {
|
|
path: path.join(__dirname, './dist/'),
|
|
filename: '[name].js',
|
|
library: 'mermaid',
|
|
libraryTarget: 'umd',
|
|
libraryExport: 'default'
|
|
},
|
|
devServer: {
|
|
contentBase: [
|
|
path.join(__dirname, 'e2e', 'platform'),
|
|
path.join(__dirname, 'dist')
|
|
],
|
|
compress: true,
|
|
port: 9000
|
|
},
|
|
module: {
|
|
rules: [amdRule, jsRule, scssRule, jisonRule]
|
|
},
|
|
externals: {
|
|
mermaid: 'mermaid'
|
|
},
|
|
devtool: 'source-map'
|
|
}
|