docz: Duplicate plugin/preset detected
Bug Report
I cannot build my project
Building complains of duplicate plugins - either it’s a bug or I have configured it wrong after following documentation.
To Reproduce
This is my basic setup:
src/Button/index.tsx
import * as React from 'react'
import style from './style.css'
export interface ButtonProps {
children: React.ReactNode;
}
export const Button = ({ children }: ButtonProps) => (
<button className={style.Button}>{children}</button>
)
src/Button/README.mdx
---
name: Hello world
---
import Button from './index.tsx'
# Hello world
Hello, I'm a mdx file!
<Button>Click</Button>
doczrc.js
module.exports = {
typescript: true,
plugins: [],
debug: true
}
.babelrc
{
"presets": [
"@babel/preset-typescript",
[
"@babel/preset-env",
{
"targets": {
"esmodules": true
}
}
],
"@babel/preset-react"
]
}
webpack.config.js
const path = require('path')
module.exports = {
entry: './src/index.tsx',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
library: 'components',
libraryTarget: 'umd'
},
externals: [
'react',
'react-dom'
],
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.css']
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.(ts|tsx|js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.css$/,
exclude: /node_modules/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
importLoaders: 1,
sourceMap: true,
modules: true,
}
},
{
loader: 'postcss-loader'
}
]
}
]
}
}
package.json
{
"name": "components",
"version": "0.0.0",
"main": "dist/index.js",
"license": "MIT",
"sideEffects": false,
"scripts": {
"build": "tsc --emitDeclarationOnly && webpack --mode production"
},
"files": [
"dist"
],
"peerDependencies": {
"react": "^16.4.1",
"react-dom": "^16.4.1"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.51",
"@babel/preset-env": "^7.0.0-beta.51",
"@babel/preset-react": "^7.0.0-beta.51",
"@babel/preset-typescript": "^7.0.0-beta.51",
"@types/react": "^16.4.1",
"autoprefixer": "^8.6.3",
"babel-loader": "^8.0.0-beta.4",
"css-loader": "^0.28.11",
"docz": "^0.3.3",
"postcss-loader": "^2.1.5",
"postcss-modules": "^1.1.0",
"postcss-preset-env": "^5.1.0",
"style-loader": "^0.21.0",
"typescript": "^2.9.2",
"webpack": "^4.12.1",
"webpack-cli": "^3.0.8"
}
}
output
component-lib · yarn docz build
yarn run v1.7.0
$ /Users/danbaker/Repos/new/component-lib/node_modules/.bin/docz build
▶ start Creating an optimized production build...
Happy[jsx]: Version: 5.0.0. Threads: 3
Happy[jsx]: All set; signaling webpack to proceed.
Happy[mdx]: Version: 5.0.0. Threads: 3
Happy[mdx]: All set; signaling webpack to proceed.
✖ fatal Failed to compile.
./.docz/app/index.jsx
Module build failed (from ./node_modules/happypack/loader.js):
Error: Duplicate plugin/preset detected.
If you'd like to use two separate instances of a plugin,
they need separate names, e.g.
plugins: [
['some-plugin', {}],
['some-plugin', {}, 'some unique name'],
]
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Expected behavior
Build
Enviroment
- OS: MacOS High Sierra
- Node version: 8.11.1
- Yarn version: 1.7.0
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (5 by maintainers)
@timbergus see #596
working on that assumption, I modified my
doczrc.js
to look like this:and the output was: