mermaid/webpack.config.base.js
2018-03-06 14:37:27 +08:00

56 lines
1.0 KiB
JavaScript

import path from 'path'
const lodashRule = {
parser: {
amd: false
},
include: /node_modules\/lodash\// // https://github.com/lodash/lodash/issues/3052
}
const jsRule = {
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
'env'
],
plugins: ['lodash']
}
}
}
const lessRule = { // load less to string
test: /\.less$/,
use: [
{ loader: 'css-to-string-loader' },
{ loader: 'css-loader' },
{ loader: 'less-loader' }
]
}
export const jsConfig = () => {
return {
mode: 'development',
target: 'web',
entry: {
mermaid: './src/mermaid.js'
},
node: {
fs: 'empty' // jison generated code requires 'fs'
},
output: {
path: path.join(__dirname, './dist/'),
filename: '[name].js',
library: 'mermaid',
libraryTarget: 'umd',
libraryExport: 'default'
},
module: {
rules: [lodashRule, jsRule, lessRule]
},
devtool: 'source-map'
}
}