我试图让 Quill 在我的 React 应用程序上工作,但根据我的 webpack 配置,它会引发两个错误:
未捕获的语法错误:意外的令牌导入
或者
未捕获的 ReferenceError:React 未定义
请注意,我没有使用 react-quill 或 create-react-app。
解决第一个错误会产生另一个错误,我读过我需要在 webpack 中创建一个例外以允许它从 quill 文件夹导入。
exclude: /node_modules/
Run Code Online (Sandbox Code Playgroud)
进入
/node_modules(?!\/quill)/
Run Code Online (Sandbox Code Playgroud)
现在它抛出第二个错误。
我的 webpack 配置文件:
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: __dirname,
publicPath: '/',
filename: 'bundle.js'
},
module: {
loaders: [{
exclude: /node_modules(?!\/quill)/,
loader: 'babel',
query: {
presets: ['react', 'es2015', 'stage-1']
}
}]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
devServer: {
historyApiFallback: true,
contentBase: './'
}
};
Run Code Online (Sandbox Code Playgroud)
我正在使用 Quill 文档中的基本代码来导入所需的内容: …
我想使用导入缺少的方法、模块等功能。但是,快速修复(ctrl 或 cmd +.)在 JS 或 Python 项目中找不到任何代码操作。灯泡不显示。

我的用户设置:
{
"workbench.activityBar.visible": true,
"workbench.statusBar.visible": true,
"window.zoomLevel": 0,
"workbench.iconTheme": "eq-material-theme-icons",
"materialTheme.cache.workbench.settings": {
"themeColours": "Default",
"accentPrevious": "Graphite"
},
"workbench.colorCustomizations": {},
"workbench.colorTheme": "Material Theme",
"explorer.confirmDragAndDrop": false,
"python.linting.pylintPath": "/usr/local/bin/pylint",
"python.linting.flake8Path": "/usr/local/bin/flake8",
"editor.renderControlCharacters": false,
"workbench.sideBar.location": "left",
}
Run Code Online (Sandbox Code Playgroud)
工作区设置:
{
"python.linting.pylintEnabled": true,
"python.linting.pep8Enabled": false,
"python.linting.enabled": true,
"python.pythonPath": "env/bin/python"
}
Run Code Online (Sandbox Code Playgroud)