styleguidist/mini-html-webpack-plugin

published v3.0.0 does not contain dist folder

swapnilmishra opened this issue · 10 comments

While upgrading to v3.0.0 I saw our build failing with error:

Error: Cannot find module 'node_modules/mini-html-webpack-plugin/dist/index.js'. Please verify that the package.json has a valid "main" entry

Upon inspecting the node_modules I found that it does not contains the dist folder.
Given below is list of files inside node_modules/mini-html-webpack-plugin for v3.0.0.

list node_modules/mini-html-webpack-plugin

├── License.md
├── README.md
└── package.json

0 directories, 3 files

Could it be that the latest release did not publish dist folder ?

Yeah, I think I know what happened. Thanks for the heads up.

🎉 This issue has been resolved in version 3.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@swapnilmishra Please give it a go now. My apologies for the inconvenience. 👍

Thanks for resolving it so quick. Appreciate it. I will try it out and update here 👍

@bebraw Now the build fails on given below error:

SyntaxError: Cannot use import statement outside a module
node_modules/mini-html-webpack-plugin/dist/index.js:1
import { __assign } from "tslib";
^^^^^^

I guess it is because Node.js (versions < 13.2.0) cannot understand import. Looking at index.js of v2.2.0, it only contained require.

One more thing, tslib is used here - import { __assign } from "tslib" but I cannot find tslib in any of dependency fields of package.json

@swapnilmishra 3.0.4 should be the one that works. There were a couple of smaller quirks in the production build.

@bebraw On 3.0.4 I get this error now:

TypeError: MiniHTMLWebpackPlugin is not a constructor
TypeError: MiniHTMLWebpackPlugin is not a constructor

To make it work one would need to change the way it is used:

before (as mentioned in README)

const MiniHTMLWebpackPlugin = require('mini-html-webpack-plugin')

now (to make it work)

const MiniHTMLWebpackPlugin = require('mini-html-webpack-plugin').default

This is because of the way tsc compiles the module - microsoft/TypeScript#2719

@swapnilmishra Yeah, I see. That's the classic CommonJS problem. To solve, I dropped the default export and now you have to do const { MiniHTMLWebpackPlugin } = require('mini-html-webpack-plugin') as that's close to the same in ES6 as well.

@swapnilmishra The version with the fix is 3.0.5.