numical / script-ext-html-webpack-plugin

Enhances html-webpack-plugin functionality with different deployment options for your scripts including 'async', 'preload', 'prefetch', 'defer', 'module', custom attributes, and inlining.
MIT License
588 stars 105 forks source link

Inline script is never output #15

Closed alsoicode closed 7 years ago

alsoicode commented 7 years ago

I'm attempting to add an inlined script to my output that lives in the same directory as my webpack config:

// test.js

console.log('Hello, from WebPack');

WebPack Configuration:

plugins: [
  . . .

  new HtmlWebpackPlugin({
    cache: false,
    template: 'src/index.html',
    title: METADATA.title,
    chunksSortMode: 'dependency',
    metadata: METADATA,
    inject: 'head'
  }),

  new ScriptExtHtmlWebpackPlugin({
    inline: ['test.js']
  }),

]

However, I never see a console statement. What am I doing wrong?

tiger8888 commented 7 years ago

I have the same problem

numical commented 7 years ago

@alsoicode, @tiger8888 - I am so sorry I have not responsed earlier - reasons... Did you solve this problem? I suspect it is your webpack config (specifically you loader config) rather anything specific to ScriptExt. If you are still trying to solve this - remove the ScriptExt plugin and see if test.js is referenced in your html file without it. If so, then it is a ScriptExt problem, if not, you need look elsewhere.

alsoicode commented 7 years ago

Hi @numical I just worked around the problem and hadn't revisited it.