Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ReferenceError: webpackJsonp_name_ is not defined #5

Closed
Yunnathai opened this issue Jan 2, 2018 · 15 comments
Closed

Uncaught ReferenceError: webpackJsonp_name_ is not defined #5

Yunnathai opened this issue Jan 2, 2018 · 15 comments

Comments

@Yunnathai
Copy link

Uncaught ReferenceError: webpackJsonp_name_ is not defined

i think the vendor.js not in html

@tldrjumps
Copy link

tldrjumps commented Jan 4, 2018

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.

@ALiangLiang
Copy link

ALiangLiang commented Jan 18, 2018

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 added a commit to ALiangLiang/vue-chrome-extension-template that referenced this issue Jan 18, 2018
@yaadyaad
Copy link

The fix of ALiangLiang works fine. Thanks a lot!

@kkinder
Copy link

kkinder commented Apr 18, 2018

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

@austince
Copy link

austince commented May 8, 2018

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
webpack/webpack#959
jantimon/html-webpack-plugin#143
webpack/webpack#368

@hkd987
Copy link

hkd987 commented Oct 31, 2018

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

@wilderchen
Copy link

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?

@eoinoc
Copy link

eoinoc commented Nov 22, 2018

The fix is here:

#16 (comment)

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

@hkd987
Copy link

hkd987 commented Nov 27, 2018

#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.

@HaoweiCh
Copy link

No clue for inject.js?

@kevinpiac
Copy link

kevinpiac commented Dec 6, 2019

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: webpack/webpack#368

Note: commenting/removing might not be the perfect solution but it works for me without causing an issue.

@operari
Copy link

operari commented Mar 15, 2020

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

@IgorBasov
Copy link

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

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

@operari
Copy link

operari commented Mar 26, 2021

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

Извините)))

@operari
Copy link

operari commented Mar 27, 2021

@IgorBasov

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests