Pug 模板加载错误 '<' 意外标记

Pug template loading error '<' unexpected token

我正在尝试使用我的 PUG 模板加载 React-jsx 文件。但我越来越

 Unexpected token '<'

当我查看浏览器控制台时。这是我的代码。我正在使用包裹。

doctype html
head
  meta(charset='UTF-8')
  title Pearson Launch
  base(href='/launch-ui')
  meta(name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no')
  link(rel='shortcut icon' href='./lib/favicon.ico')
script(type='application/javascript' src='jsx/main.jsx')

我是 Pug 模板相关开发的新手。你能解释一下这不可能吗?

这里的问题是文件路径不正确。我刚刚创建了一个虚拟路径如下。

app.use('/javascripts', express.static(path.join(__dirname, 'public')));

在我的哈巴狗模板中,我只是这样使用脚本标签。

script( src='javascripts/jsx/main.jsx')

现在我的文件正在正确加载。由于 pug 是服务器端渲染,我可以预期它在浏览器中的行为方式。 但是还有一个问题就是,

SyntaxError: Cannot use import statement outside a module

我会调查这个,我认为这是这个问题的答案。