-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation example seems wrong #114
Comments
Not sure it's required to include Are you getting errors without it? |
I do not think the |
You can do |
Thanks for the response @SimenB! I'm not familiar enough with Typescript to understand the implications of switching to use Looks like all we lose is the ability for someone to require |
After some testing, looks like unless webpack.config.ts:1:8 - error TS1192: Module '"/Users/chris/github/clean-webpack-plugin/dist/clean-webpack-plugin"' has no default export.
1 import CleanWebpackPlugin from 'clean-webpack-plugin';
~~~~~~~~~~~~~~~~~~
Found 1 error. |
Looks like without As of right now I'm not against the idea of migrating to use |
Oh, this lib is written in TS, I thought it just had a Jest will move to ES module exports in the next major and ditch One thing you can do is have a named export in addition to the default one, so people can do |
#138 will resolve this issue. |
released with |
Maybe it's not a good idea to just replace the default export with named export. I think it's better to keep both named export and default export at the same time. export CleanWebpackPlugin;
export default CleanWebpackPlugin; |
@jinliming2 I wish there were a better way for common js and modules to work. I personally think dropping the default export is the best solution and I don't see us reverting the change. If you'd like to rename the named export, you can do so: // es modules variable named "CleanPlugin"
import { CleanWebpackPlugin as CleanPlugin } from 'clean-webpack-plugin';
// common js variable named "CleanPlugin"
const { CleanWebpackPlugin: CleanPlugin } = require('clean-webpack-plugin'); |
Issue description or question
The sample code in
readme.md
reads (comments removed for brevity):I, however, have to write:
Webpack Config
... for Visual Studio Code (and the TypeScript compiler) to correctly construct
clean-webpack-plugin
.Please note the additional
.default
in the first line.Shouldn't this additionally required
.default
be mentioned in thereadme.md
file?Environment
Run:
npx envinfo --system --binaries --npmPackages clean-webpack-plugin,webpack
The text was updated successfully, but these errors were encountered: