Closed madhums closed 6 years ago
Ah! I see that this has to be used as a next.js plugin. I just tried that but I now get this error in the web console.
[absolute-resource-path]:3935 Uncaught TypeError: Cannot set property 'sourceMapSupport' of undefined
at [absolute-resource-path]:3935
at Object.node_modulesZeitSourceMapSupportBrowserSourceMapSupportJs ([absolute-resource-path]:3935)
at __webpack_require__ (manifest.js?3659:1242)
at fn (manifest.js?3659:1208)
at Object.node_modulesNextDistClientNextDevJs ([absolute-resource-path]:4634)
at __webpack_require__ (manifest.js?3659:1242)
at fn (manifest.js?3659:1208)
at Object._ ([absolute-resource-path]:8802)
at __webpack_require__ (manifest.js?3659:1242)
at webpackJsonpCallback (manifest.js?3659:1196)
@sheerun Any clue?
Have you added it exactly the same way as in the readme? What's your next.config.js and package.json?
Seems to be working great with
// next.config.js
const TargetsPlugin = require("targets-webpack-plugin");
module.exports = {
webpack: function (config, { dev }) {
if (!dev) {
config.plugins.push(new TargetsPlugin({
browsers: ["last 2 versions", "chrome >= 41"]
}))
}
return config
}
}
Thanks @sheerun!! Took me some time to figure out the correct usage, added PR #2
Yes, it should be used only for production build
Hi, I came across your comment from this thread https://github.com/zeit/next.js/issues/3205#issuecomment-384673971
Unfortunately, I am having some issues getting this plugin to work with .babelrc. Here's the stack trace
My
.babelrc
looks like thisI am using this in a next.js project. Do you happen to have any clue why this is not working?