mermaid-webpack-demo icon indicating copy to clipboard operation
mermaid-webpack-demo copied to clipboard

Does not work with webpack in "Production" mode, with uglify.

Open jon-peel opened this issue 7 years ago • 4 comments

Hi, I am having problems with Mermaid and Webpack in my project, so I decided to use this repo as a test.

I cloned the repo and ran the npm build script, which worked without any trouble. I then modified the build script in the package.config file to more closely match the one I am using in my project. I used "build": "webpack --progress --colors -p"

I then tried to run the build script again, and it did not work. The error I am getting is

ERROR in index.bundle.js from UglifyJs
Unexpected token: name (v) [index.bundle.js:22759,6]

jon-peel avatar Apr 06 '18 06:04 jon-peel

UglifyJS doesn't support ES6. So this is actually a general issue in JS world, not closely related to mermaid.

tylerlong avatar Apr 13 '18 02:04 tylerlong

Cool, I managed to use Bable instead of Ugligy.

@tylerlong should I close this issue?

jon-peel avatar Apr 13 '18 04:04 jon-peel

Would you mind sharing how you did it? I'm not a webpack expert but experiencing this issue as well.

kenny-chow-my avatar Nov 21 '18 08:11 kenny-chow-my

I am also not a webpack export, my config is hacked together using bits I could figure out online. in my webpack file under module.exports={} I have

module: {
        loaders: [
            {
                test: /\.tsx?$/,
                loaders: ['babel-loader', 'awesome-typescript-loader'],
                exclude: [/node_modules/]

            },
            // ... more loaders are here.
        ]
    },

There will be dependencies that will be needed, i.e. npm install --save-dev babel loader

jon-peel avatar Nov 21 '18 10:11 jon-peel