Skip to content
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

Plugin/Preset files are not allowed to export objects, only functions. #11

Closed
yaotusa opened this issue Dec 28, 2023 · 2 comments · Fixed by #13
Closed

Plugin/Preset files are not allowed to export objects, only functions. #11

yaotusa opened this issue Dec 28, 2023 · 2 comments · Fixed by #13
Assignees

Comments

@yaotusa
Copy link

yaotusa commented Dec 28, 2023

1、Dear all, my babel config is as follows

export default (api) => {
api.cache(true)

const presets = [
[
'@babel/preset-env',
{
corejs: '3.34',
useBuiltIns: 'entry',
// debug: true,
},
],
'@babel/preset-react',
]

const plugins = [
['module:@react-three/babel'],
]

return {
presets,
plugins,
}
}

2、my package.json is as follows

{
"name": "cloud-office-util-doc",
"version": "1.0.0",
"engines": {
"node": ">=18.0.0"
},
"dependencies": {
"@react-three/fiber": "^8.15.12",
"babel-runtime": "^6.26.0",
"core-js": "^3.34.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"three": "^0.155.0",
},
"devDependencies": {
"@babel/core": "^7.23.6",
"@babel/plugin-proposal-decorators": "^7.23.6",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-object-assign": "^7.23.3",
"@babel/plugin-transform-runtime": "^7.23.6",
"@babel/preset-env": "^7.23.6",
"@babel/preset-react": "^7.23.3",
"@babel/runtime": "^7.23.6",
"@react-three/babel": "^1.0.1",
"@react-three/eslint-plugin": "^0.1.1",
"@types/node": "^18.19.3",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"@types/three": "^0.155.1",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"autoprefixer": "^10.4.16",
"babel-loader": "^9.1.3",
"babel-plugin-import": "^1.13.8",
"babel-plugin-lodash": "^3.3.4",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
"chalk": "^5.3.0",
"classnames": "^2.3.2",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^11.0.0",
"cross-env": "^7.0.3",
"css-loader": "^6.8.1",
"css-minimizer-webpack-plugin": "^5.0.1",
"eslint": "^8.56.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unicorn": "^50.0.1",
"fibers": "^5.0.3",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"html-webpack-plugin": "^5.6.0",
"husky": "^8.0.3",
"less": "^4.2.0",
"less-loader": "^11.1.3",
"lint-staged": "^15.2.0",
"mini-css-extract-plugin": "^2.7.6",
"moment-locales-webpack-plugin": "^1.2.0",
"patch-package": "^8.0.0",
"postcss": "^8.4.32",
"postcss-less": "^6.0.0",
"postcss-loader": "^7.3.3",
"postcss-scss": "^4.0.9",
"prettier": "^3.1.1",
"resolve-url-loader": "^5.0.0",
"rimraf": "^5.0.5",
"sass": "^1.69.5",
"sass-loader": "^13.3.2",
"style-loader": "^3.3.3",
"stylelint": "^16.0.2",
"stylelint-config-prettier-scss": "^1.0.0",
"stylelint-config-standard-scss": "^12.0.0",
"thread-loader": "^4.0.2",
"ts-loader": "^9.5.1",
"typescript": "^5.3.3",
"webpack": "^5.89.0",
"webpack-bundle-analyzer": "^4.10.1",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
"webpack-merge": "^5.10.0"
},
}

3、when i compile the code with webpack, it output follow errors, how can i fix it;

ERROR in ./src/index.tsx
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
Plugin/Preset files are not allowed to export objects, only functions. In G:\gerrit_workspace\animation-editor-web\node_modules@react-three\babel\dist\index.mjs
at PoolWorker.fromErrorObj (G:\gerrit_workspace\animation-editor-web\node_modules\thread-loader\dist\WorkerPool.js:302:12)
at G:\gerrit_workspace\animation-editor-web\node_modules\thread-loader\dist\WorkerPool.js:184:29
at mapSeries (G:\gerrit_workspace\animation-editor-web\node_modules\neo-async\async.js:3625:14)
at PoolWorker.onWorkerMessage (G:\gerrit_workspace\animation-editor-web\node_modules\thread-loader\dist\WorkerPool.js:148:34)
at G:\gerrit_workspace\animation-editor-web\node_modules\thread-loader\dist\WorkerPool.js:124:14
at createDescriptor (G:\gerrit_workspace\animation-editor-web\node_modules@babel\core\lib\config\config-descriptors.js:160:11)
at createDescriptor.next ()
at step (G:\gerrit_workspace\animation-editor-web\node_modules\gensync\index.js:261:32)
at G:\gerrit_workspace\animation-editor-web\node_modules\gensync\index.js:273:13
at async.call.result.err.err (G:\gerrit_workspace\animation-editor-web\node_modules\gensync\index.js:223:11)

Plugin/Preset files are not allowed to export objects, only functions.

@umar-ahmed
Copy link
Collaborator

Oof looks like I missed that when I reviewed #10. Sorry 🙏

Will issue a patch soon.

@umar-ahmed
Copy link
Collaborator

@yaotusa Released a fix in v1.0.2

Let me know if that fixes the issue for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants