webpack 构建中意外的令牌“导出”

2024-01-06

我收到的错误是 webpack 无法将导出识别为关键字。我已经更新了 .babelrc 并安装了必要的依赖项。我确信这与不理解 es6 有关,但我找不到解决我的问题的解决方案。以下是查看我的依赖项、错误和重要文件所需的文件。

./index.scss 中的错误模块构建失败(来自 ./node_modules/extract-loader/lib/extractLoader.js): /Users/rahmijamalpruitt/Documents/LetsGraduate/BigCo/CooleyProduct/White-Blob.png:1 导出默认值webpack_public_path+ “5d40bf92e9838f27f887c783f1001e8f.png”; ^^^^^^ 语法错误:意外 令牌“导出”

目录

CornellTech.png   
buildings.jpeg    
index.scss
Orange-Blob.png   
index.css         
node_modules
RahmiHeadShot.jpg 
index.css.map     
package-lock.json
SuitGuy.png       
index.html        
package.json
White-Blob.png    
index.js          
webpack.config.js

webpack.config.js

const autoprefixer = require("autoprefixer");

module.exports = {
  entry: ["./index.scss", "./index.js"],
  output: {
    filename: "bundle.js"
  },
  module: {
    rules: [
      {
        test: /\.scss$/,
        use: [
          {
            loader: "file-loader",
            options: {
              name: "bundle.css"
            }
          },
          { loader: "extract-loader" },
          { loader: "css-loader" },
          {
            loader: "postcss-loader",
            options: {
              plugins: () => [autoprefixer()]
            }
          },
          {
            loader: "sass-loader",
            options: {
              sassOptions: {
                includePaths: ["./node_modules"]
              }
            }
          }
        ]
      },
      {
        test: /\.js$/,
        loader: "babel-loader",
        query: {
          presets: ["@babel/preset-env"]
        }
      },
      {
        test: /\.(gif|png|jpe?g|svg)$/i,
        use: [
          "file-loader",
          {
            loader: "image-webpack-loader",
            options: {
              bypassOnDebug: true, // [email protected] /cdn-cgi/l/email-protection
              disable: true // [email protected] /cdn-cgi/l/email-protection and newer
            }
          }
        ]
      }
    ]
  }
};

索引.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=<>, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <link rel="stylesheet" href="bundle.css" />
  </head>
  <body>
    <section class="page1">
      <nav>
        <ul>
          <li class="Logo"><a> LOGO </a></li>
          <li><a> about us </a></li>
          <li>
            <button class="sign-up-button mdc-button">sign up</button>
          </li>
          <li>
            <button class="login-button mdc-button">login</button>
          </li>
          <li id="CornellLogo">
            <img src="CornellTech.png" />
          </li>
        </ul>
      </nav>
      <div class="page-content">
        <div id="images">
          <div id="blob1"></div>
          <div id="blob2"></div>
          <div id="blob3"></div>
          <div id="blob4"></div>
          <div id="suit-guy"></div>
        </div>
        <div class="title">
          <h1>The best tool for the best firms</h1>
          <p>A new solution for the firm pushing the future fowards</p>
        </div>
      </div>
      <div id="myModal" class="modal login">
        <!-- Modal content -->
        <div class="modal-content">
          <span class="close">&times;</span>
          <p>Some text in the Modal..</p>
        </div>
      </div>
    </section>

    <section class="page2">
      <div id="building">
        <img src="buildings.jpeg" />
      </div>
      <div id="product-description">
        <h1>
          Let this be the year of producivity
        </h1>
      </div>
    </section>

    <section class="page3">
      <nav>
        <ul>
          <li class="Logo"><a> LOGO </a></li>
          <li><h1>The Team</h1></li>
        </ul>
      </nav>

      <div class="cards-grid">
        <div class="card middle item1">
          <div class="front">
            <img src="RahmiHeadShot.jpg" alt="picture of Rahmi Pruitt" />
          </div>
          <div class="back">
            <div class="back-content middle">
              <h2>Rahmi Pruitt</h2>
              <a
                class="resume-link"
                href="https://drive.google.com/file/d/1eANUSP0vOfGWgees6z51FFN0op4fzCPr/view?usp=sharing"
              >
                Software Engineer / Designer
              </a>
              <p>
                Passionate about fullstack development. Resume can be seen below
              </p>
            </div>
          </div>
        </div>
        <div class="card middle item2">
          <div class="front">
            <img src="RahmiHeadShot.jpg" alt="picture of Rahmi Pruitt" />
          </div>
          <div class="back">
            <div class="back-content middle">
              <h2>Rahmi Pruitt</h2>
              <a
                class="resume-link"
                href="https://drive.google.com/file/d/1eANUSP0vOfGWgees6z51FFN0op4fzCPr/view?usp=sharing"
              >
                Software Engineer / Designer
              </a>
              <p>
                Passionate about fullstack development. Resume can be seen below
              </p>
            </div>
          </div>
        </div>
        <div class="card middle item3">
          <div class="front">
            <img src="RahmiHeadShot.jpg" alt="picture of Rahmi Pruitt" />
          </div>
          <div class="back">
            <div class="back-content middle">
              <h2>Rahmi Pruitt</h2>
              <a
                class="resume-link"
                href="https://drive.google.com/file/d/1eANUSP0vOfGWgees6z51FFN0op4fzCPr/view?usp=sharing"
              >
                Software Engineer / Designer
              </a>
              <p>
                Passionate about fullstack development. Resume can be seen below
              </p>
            </div>
          </div>
        </div>
        <div class="card middle item4">
          <div class="front">
            <img src="RahmiHeadShot.jpg" alt="picture of Rahmi Pruitt" />
          </div>
          <div class="back">
            <div class="back-content middle">
              <h2>Rahmi Pruitt</h2>
              <a
                class="resume-link"
                href="https://drive.google.com/file/d/1eANUSP0vOfGWgees6z51FFN0op4fzCPr/view?usp=sharing"
              >
                Software Engineer / Designer
              </a>
              <p>
                Passionate about fullstack development. Resume can be seen below
              </p>
            </div>
          </div>
        </div>
        <div class="card middle item5">
          <div class="front">
            <img src="RahmiHeadShot.jpg" alt="picture of Rahmi Pruitt" />
          </div>
          <div class="back">
            <div class="back-content middle">
              <h2>Rahmi Pruitt</h2>
              <a
                class="resume-link"
                href="https://drive.google.com/file/d/1eANUSP0vOfGWgees6z51FFN0op4fzCPr/view?usp=sharing"
              >
                Software Engineer / Designer
              </a>
              <p>
                Passionate about fullstack development. Resume can be seen below
              </p>
            </div>
          </div>
        </div>
      </div>
    </section>
    <script type="module" src="/bundle.js" async></script>
  </body>
  <script src="https://unpkg.com/material-components-web/dist/material-components-web.min.js"></script>
  <script src="homepage.js"></script>
</html>

.babelrc

{
  "presets": ["@babel/preset-env"]
}

包.json

{
  "name": "cooleyproduct",
  "version": "1.0.0",
  "description": "",
  "main": "homepage.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "webpack-dev-server",
    "build": "webpack"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/cli": "^7.7.7",
    "@babel/core": "^7.7.7",
    "@babel/preset-env": "^7.7.7",
    "autoprefixer": "^9.7.3",
    "babel-loader": "^8.0.6",
    "css-loader": "^3.4.0",
    "extract-loader": "^3.1.0",
    "file-loader": "^5.0.2",
    "image-webpack-loader": "^6.0.0",
    "node-sass": "^4.13.0",
    "postcss-loader": "^3.0.0",
    "sass-loader": "^8.0.0",
    "webpack": "^4.41.5",
    "webpack-cli": "^3.3.10",
    "webpack-dev-server": "^3.10.1"
  },
  "dependencies": {
    "@material/button": "^4.0.0",
    "@material/ripple": "^4.0.0"
  }
}

我发现从 webpack.config.js 中删除 extract-loader 插件足以让我的代码运行。我认为这与 extract-loader 插件无法与 scss 一起使用有关。该文档特别指出它是为html 和 CSS https://github.com/peerigon/extract-loader。如果有人仍然对 extract-loader 插件感兴趣,可以找到它here https://www.npmjs.com/package/sass-extract-loader

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

webpack 构建中意外的令牌“导出” 的相关文章

随机推荐

  • Canvas 和 HTML5:支持的浏览器吗?

    我正在考虑在我即将进行的项目中使用 HTML5 Canvas 元素 我想知道所有主要浏览器 包括版本 因为我知道最新版本确实支持画布 都支持 Canvas 标签 我根本不关心IE 所以不用费心举报IE 在本教程中绘制形状 MDC https
  • 是否可以在 jUnit 测试运行期间禁用 log4j 异常输出?

    在 jUnit 测试运行期间需要禁用 log4j 输出到控制台 但应启用所有其他 log4j 输出 在测试过程中检查方法对错误参数的反应时会出现很多异常 因此异常是可以的 创建一个新的 log4j 属性文件 例如log4j test pro
  • Connect或Express中间件修改response.body [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 我想要一个修改响应正文的中间件函数 这是针对快速服务器的 就像是 function modify re
  • 在 Xamarin.iOS 中隐藏和显示控件

    我是 Xamarin iOS 初学者 我也没有太多 iOS 原生经验 我试图隐藏和显示包含 UILabel 和 UITextField 的 UIView 尽管视图的隐藏属性设置为 true 但它仍然占据屏幕中的空间 如何删除这个空格 如果我
  • 如何在Python中求解带有矩阵变量的方程?

    我正在用 Python 编码 并且正在研究立体相关 我想解这个方程 m K T M m K M 是已知的 where M是笛卡尔坐标系 世界 中点的齐次坐标 M np array X Y Z 1 K是我的左摄像头的内在矩阵 K np mat
  • 通过连接 iOS 中的表从 Firebase 获取数据

    我正在尝试从两个不同的 Firebase 表中获取数据 这是表的结构 Post 1 pImages i1 true i2 true 2 pImages i3 true Images i1 iUrl pId 1 i2 iUrl pId 1 i
  • numpy/scipy 中 N 点与参考之间的高效距离计算

    我刚刚开始使用 scipy numpy 我有一个100000 3的数组 每一行都是一个坐标 以及一个1 3的中心点 我想计算数组中每一行到中心的距离并将它们存储在另一个数组中 最有效的方法是什么 我会看一下scipy spatial dis
  • Azure 注销重定向 (post_logout_redirect_uri) 不起作用

    完成注销后 Azure 注销页面不会重定向用户 它只返回这条消息 您已退出帐户 关闭所有浏览器是个好主意 视窗 我尝试了不同的注销 URL https login microsoftonline com MY TENANT oauth2 l
  • 如何在Python中并行添加两个嵌套列表并将结果附加到新列表

    我正在尝试并行添加两个不等嵌套列表的所有元素 并将结果附加回另一个新列表 我编写了一些可以添加它们的黑客代码 但是代码有很多问题 首先我试图通过在列表末尾附加 0 来使这些对相等 但代码仍然遇到问题 因为第一对的长度是 3 第二对的长度是
  • Tkinter 从按钮动态创建小部件

    我正在尝试制作一个动态 GUI 其中单击按钮会创建一个新框架 该框架放置在按钮上方 其中包含 3 个条目小部件 用户选项 并且我需要能够从中读取用户输入3 个条目小部件并可能更改它们 每次按下按钮时 都会出现三个新的可调用条目小部件 我知道
  • lldb 无法打印调试代码中的值

    在 lldb 中打印值时 出现以下错误 error no member named rec in namespace lldb local vars 我的代码是用 g编译的 为什么 lldb 无法打印值 lldb local vars是为了
  • Nodejs 模块和重复?如果应用程序使用两个需要公共模块的模块,节点是否会进行优化以防止加载相同的代码两次?

    如果这是一个愚蠢的问题 我深表歉意 但是如果我创建两个模块 它们都需要 http 并且我的主应用程序需要这两个模块 或者需要模块 而这些模块又需要这两个模块 同时还需要 http 作为其自己的模块目的 我最终会得到 http 模块的三个实例
  • 使用 Lambda 语法的 C# LINQ 多个 GroupJoin

    我有 3 个表 我试图使用左连接将它们组合在一起 在我的应用程序中 所有 LINQ 表达式都是查询链格式 lambda 表达式 我试图弄清楚如何使用 LINQ 完成这个查询 这是我的 SQL 查询 select i INVOICE NUMB
  • 关于 SimpleModal jQuery 插件的问题——初始打开后可以重新居中吗?

    我的问题与SimpleModal jQuery 插件 http www ericmmartin com projects simplemodal 我打开模态窗口没有问题 但是一旦它打开 它就会停留在屏幕上 居中 的位置 但是它的内容正在发生
  • 如何防止在 Razor(独立)中转义 html?

    我有一个模型 其属性 Content 包含 HTML 字符串 var model new Content Razor Parse templateBody model 如何使用独立 Razor 渲染此字符串 I tried new Html
  • 为什么在 try 块中重新声明函数标识符会引发语法错误?

    以下 JavaScript 行 try function free var free 1 finally 导致以下错误 Uncaught SyntaxError Identifier free has already been declar
  • R 中从右到左的语言支持(使用 Mac)

    我想知道在使用 Mac 时是否有支持 R 中从右到左语言的方法 例如假设以下代码 x lt data frame a runif 10 b runif 10 ggplot x aes a b geom point xlab 结果如下 在这里
  • 绑定到静态类实例中的属性

    我想要实现的目标 我有一个 WPF 应用程序 仅用于测试 我想将标签的文本 内容 绑定到某处的属性 这个想法是 当用户选择不同的语言时 该属性值将会改变 当属性更改时 我希望标签文本更新为新值 我尝试过的 我尝试创建一个具有标签值静态属性的
  • 检查 Internet Explorer 中的伪元素

    我有以下伪元素 input type radio selected before 在互联网浏览器中 伪元素根本不显示 所以我决定看一下 我在检查器中找到了选择器 检查器中的选择器将是一本很棒的儿童读物 但是所有属性都被删除了 即覆盖 无效
  • webpack 构建中意外的令牌“导出”

    我收到的错误是 webpack 无法将导出识别为关键字 我已经更新了 babelrc 并安装了必要的依赖项 我确信这与不理解 es6 有关 但我找不到解决我的问题的解决方案 以下是查看我的依赖项 错误和重要文件所需的文件 index scs