vue-chrome-extension-template icon indicating copy to clipboard operation
vue-chrome-extension-template copied to clipboard

Uncaught ReferenceError: webpackJsonp_name_ is not defined

Open jamninetyfive opened this issue 6 years ago • 15 comments

Uncaught ReferenceError: webpackJsonp_name_ is not defined

i think the vendor.js not in html

jamninetyfive avatar Jan 02 '18 07:01 jamninetyfive

Workaround:

  • Remove first one of the commonsChunkPlugin will work on webpack.prod.js I suspect the same, it might be the Webpack.js must be chunk into specific .js, Sorry zero knowledge about how Webpack work.

tldrjumps avatar Jan 04 '18 08:01 tldrjumps

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>

ALiangLiang avatar Jan 18 '18 20:01 ALiangLiang

The fix of ALiangLiang works fine. Thanks a lot!

yaadyaad avatar Jan 31 '18 11:01 yaadyaad

Adding those to the content/popup files works for them, but not for the injected js.

kkinder avatar Apr 18 '18 15:04 kkinder

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

austince avatar May 08 '18 08:05 austince

@ALiangLiang where exactly are you injecting the script tags? Think we could make this clear for future people looking to solve this issue.

hkd987 avatar Oct 31 '18 14:10 hkd987

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?

wilderchen avatar Nov 12 '18 13:11 wilderchen

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']),  
  ...  
]

eoinoc avatar Nov 22 '18 12:11 eoinoc

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.

hkd987 avatar Nov 27 '18 21:11 hkd987

No clue for inject.js?

HaoweiCh avatar Apr 16 '19 21:04 HaoweiCh

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.

kevinpiac avatar Dec 06 '19 10:12 kevinpiac

Мда если русский берется - то никогда до конца, до ума дело не доведет. Мне уже надоело мучаться со всеми возникшими проблемами. Расширение готово, но не работает из-за кривой сборки. Спасибо!

operari avatar Mar 15 '20 09:03 operari

Мда если русский берется - то никогда до конца, до ума дело не доведет. Мне уже надоело мучаться со всеми возникшими проблемами. Расширение готово, но не работает из-за кривой сборки. Спасибо!

Держите себя в руках, сударь. Вам здесь никто и ничего не должен! А Ваши суждения попахивают шовинизмом, а потому недостойны нормального человека. Извинитесь!

IgorBasov avatar Mar 26 '21 04:03 IgorBasov

Держите себя в руках, сударь. Вам здесь никто и ничего не должен! А Ваши суждения попахивают шовинизмом, а потому недостойны нормального человека. Извинитесь!

Извините)))

operari avatar Mar 26 '21 08:03 operari

@IgorBasov

Если серьезно. Вы упрекаете меня в шовинизме, хотя делите людей на достойных и недостойных. Вы говорите что никто никому ничего не должен, хотя просите, чтобы я за что-то извинился. Извинился за Ваши суждения отклонёнными когнитивными искажениями. Мои же суждения - это обычная реакция экспрессиониста.

operari avatar Mar 27 '21 23:03 operari