我想将以下内容添加到我的 webpack 配置中!
module.exports = {
...otherConfig,
plugins: [
new CopyPlugin([{
from: './node_modules/@pdftron/webviewer/public',
to: './dist/public/webviewer'
}]
),
],
};
Run Code Online (Sandbox Code Playgroud)
但是,由于我使用的是 Next.js,因此我遵循此处的文档: https ://nextjs.org/docs/api-reference/next.config.js/custom-webpack-config
这是我最终得到的代码:
const CopyPlugin = require("copy-webpack-plugin");
module.exports = {
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
// Note: we provide webpack above so you should not `require` it
// Perform customizations to webpack config
const newconfig = config.plugins.push(
new CopyPlugin([
{
from: './node_modules/@pdftron/webviewer/public',
to: './public/webviewer',
},
]),
);
// Important: return the modified config …Run Code Online (Sandbox Code Playgroud) 嘿嘿
我正在尝试将 mailchimp 集成添加到我的 nextjs 站点,但似乎无法通过next/Head在我的自定义中添加以下内容来实现_document
<script id="mcjs">!function(c,h,i,m,p){m=c.createElement(h),p=c.getElementsByTagName(h)[0],m.async=1,m.src=i,p.parentNode.insertBefore(m,p)}(document,"script","https://chimpstatic.com/mcjs-connected/js/users/6de8d2d6c939d766316a64859/bd399ce06369bd3a09a174bb7.js");</script>
Run Code Online (Sandbox Code Playgroud)
我认为这个问题与脚本标签是!function.
任何帮助表示赞赏。谢谢!
我得到的错误是
remote: Error occurred prerendering page
remote: ReferenceError: c is not defined
Run Code Online (Sandbox Code Playgroud)