No manual global mermaid

This commit is contained in:
Tyler Long
2017-09-09 21:47:21 +08:00
parent 5da8c26cb6
commit fc5c07027c
6 changed files with 46 additions and 118 deletions

View File

@@ -1,5 +1,4 @@
import path from 'path'
import nodeExternals from 'webpack-node-externals'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
const rules = [
@@ -11,7 +10,7 @@ const rules = [
}
]
export const webConfig = () => {
export const jsConfig = () => {
return {
target: 'web',
entry: {
@@ -20,7 +19,10 @@ export const webConfig = () => {
externals: ['fs'],
output: {
path: path.join(__dirname, './dist/'),
filename: '[name].js'
filename: '[name].js',
library: 'mermaid',
libraryTarget: 'umd',
libraryExport: 'default'
},
module: {
rules: rules.concat([
@@ -46,41 +48,6 @@ export const webConfig = () => {
}
}
export const nodeConfig = () => {
return {
target: 'node',
entry: {
mermaidAPI: './src/mermaidAPI.js'
},
externals: [nodeExternals()],
output: {
path: path.join(__dirname, './dist/'),
filename: '[name].js',
libraryTarget: 'commonjs2'
},
module: {
rules: rules.concat([
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
['env', {
'targets': {
'node': '6.9'
}
}]
]
}
}
}
])
}
}
}
export const lessConfig = () => {
return {
target: 'web',