Closed jamninetyfive closed 1 year ago
Workaround:
Have same problem. It's fine in dev script but it happens in build script.
I has no knowledge about how Webpack work too. But I found a workaround. Add manifest.js and verdor.js to every pages. ex.
<!-- add below two js before target js file -->
<script type="text/javascript" src="/js/manifest.js"></script></body>
<script type="text/javascript" src="/js/vendor.js"></script></body>
<script type="text/javascript" src="/js/background.js?688071810bcfb2f5e4b6"></script></body>
<!-- add below two js before target js file -->
<script type="text/javascript" src="/js/manifest.js"></script></body>
<script type="text/javascript" src="/js/vendor.js"></script></body>
<script type="text/javascript" src="/js/popup.js?688071810bcfb2f5e4b6"></script></body>
The fix of ALiangLiang works fine. Thanks a lot!
Adding those to the content/popup files works for them, but not for the injected js.
Here are some good resources I've found but haven't quite figured out yet:
https://github.com/szrenwei/inline-manifest-webpack-plugin/tree/v3.0.1
https://github.com/webpack/webpack/issues/959
https://github.com/jantimon/html-webpack-plugin/issues/143
https://github.com/webpack/webpack/issues/368
@ALiangLiang where exactly are you injecting the script tags? Think we could make this clear for future people looking to solve this issue.
Adding those to the content/popup files works for them, but not for the injected js.
Do you have any idea to make it work for the injected js?
The fix is here:
https://github.com/YuraDev/vue-chrome-extension-template/issues/16#issuecomment-423745665
Edit webpack.base.js
From:
plugins: [
htmlPage('popup', 'popup', ['popup']),
htmlPage('background', 'background', ['background']),
...
]
To:
plugins: [
htmlPage('popup', 'popup', ['manifest', 'vendor', 'popup']),
htmlPage('background', 'background', ['manifest', 'vendor', 'background']),
...
]
https://github.com/YuraDev/vue-chrome-extension-template/pull/21
I went ahead and submitted this for a pull
edit: I see that it probably will not be published since this repo seems to no longer be maintained.
No clue for inject.js?
Hey guys, @HaoweiCh,
A workaround for inject.js I found is to comment/remove CommonChunkPlugin from webpack.prod file.
/// ............ webpack.prod.js
new ExtractTextPlugin({
filename: 'css/[name].[contenthash].css'
}),
new webpack.HashedModuleIdsPlugin(),
//
// new webpack.optimize.CommonsChunkPlugin({
// name: 'vendor',
// minChunks: function (module) {
// return (
// module.resource &&
// /\.js$/.test(module.resource) &&
// module.resource.indexOf(
// path.join(__dirname, '../node_modules')
// ) === 0
// )
// }
// }),
// new webpack.optimize.CommonsChunkPlugin({
// name: 'manifest',
// chunks: ['vendor']
// })
The reason is explained here: https://github.com/webpack/webpack/issues/368
Note: commenting/removing might not be the perfect solution but it works for me without causing an issue.
Мда если русский берется - то никогда до конца, до ума дело не доведет. Мне уже надоело мучаться со всеми возникшими проблемами. Расширение готово, но не работает из-за кривой сборки. Спасибо!
Мда если русский берется - то никогда до конца, до ума дело не доведет. Мне уже надоело мучаться со всеми возникшими проблемами. Расширение готово, но не работает из-за кривой сборки. Спасибо!
Держите себя в руках, сударь. Вам здесь никто и ничего не должен! А Ваши суждения попахивают шовинизмом, а потому недостойны нормального человека. Извинитесь!
Держите себя в руках, сударь. Вам здесь никто и ничего не должен! А Ваши суждения попахивают шовинизмом, а потому недостойны нормального человека. Извинитесь!
Извините)))
@IgorBasov
Если серьезно. Вы упрекаете меня в шовинизме, хотя делите людей на достойных и недостойных. Вы говорите что никто никому ничего не должен, хотя просите, чтобы я за что-то извинился. Извинился за Ваши суждения отклонёнными когнитивными искажениями. Мои же суждения - это обычная реакция экспрессиониста.
Uncaught ReferenceError: webpackJsonpname is not defined
i think the vendor.js not in html