Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

SpaServices Webpack Dev Middleware - automatic insertion of "webpack-hot-middleware/client" #432

Closed
kukjevov opened this issue Nov 15, 2016 · 3 comments

Comments

@kukjevov
Copy link

I have problem with automatic prepending of "webpack-hot-middleware/client" to each entry in webpack config.

Maybe i have something wrong in my configuration but. i have following configuration (snippet):

entry:
{
    "style": [path.join(__dirname, "content/site.scss")],
    "app": [path.join(__dirname, "app/app.ts")],
    "polyfills-import": path.join(__dirname, "app/polyfills.ts"),
    "vendor-import": path.join(__dirname, "app/vendor.ts")
},
module:
{
    loaders:
    [
        {
            test: /\.ts$/,
            loaders: ['awesome-typescript-loader', 'angular2-template-loader']
        },
        {
            test: /\.html$/,
            loader: 'raw-loader'
        },
        {
            test: /\.json$/,
            loader: 'json-loader'
        },
        {
            test: /\.scss$/,
            loaders: ['style-loader', 'css-loader', 'sass-loader']
        },
        {
            test: /\.(ttf|eot|svg)$/,
            loader: "file-loader"
        }
    ]
},

When you prepend that "webpack-hot-middleware/client" HMR string for each entry point my "style" entry does not inject css into html anymore. It works if you append it, but HMR is still not working for style entry, that means if i change something in scss, file is compiled, but nothing is replaced when finishes.

Maybe this is not problem of this middleware, maybe it is just my configuration which is not correct.

Thank you for your help.

@SteveSandersonMS
Copy link
Member

That's strange. I tried to reproduce your issue, but everything worked perfectly well (the styles appeared, and HMR continued to work). So I'm not sure how to know what's going wrong in your case based on your config alone.

Here's the code I used when attempting to repro the issue: e971dde

Could you let me know whether that works for you? And if you're trying to do something different, what in particular is different in your scenario? Could you describe the full minimal set of changes needed to reproduce the issue based on the Angular2Spa code like in the branch I've linked to?

@SteveSandersonMS
Copy link
Member

I'll close this since AFAIK it works and we don't have any repro steps that recreate the originally described issue.

If anyone knows how to repro this, please file a new issue!

@kukjevov
Copy link
Author

kukjevov commented Nov 22, 2016

Hi thank you very much for your sample commit. Thanks to it i found solution :).

Problem was that i included style.js in html head but it must be included in body after vendor.js. Now it is working. Thank you very much again.

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

No branches or pull requests

2 participants