-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
TypeError due to assuming all <script> elements have a src attribute #117
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
Comments
Yep, that's an error... that's probably not a good fallback to get the base path. @sokra when is |
It only checks the current script tag, which should be the script tag for the webpack-dev-server client.
|
@sokra @steveme @jhnns I have very similar issue: webpack-dev-server --hot --inline --progress --colors
70% 1/1 build modules
TypeError: Object /Users/me/github/app-webpack/node_modules/webpack-dev-server/client/index.js?http://localhost:8080,webpack/hot/dev-server,webpack/hot/dev-server has no method 'replace'
at Tapable.<anonymous> (/Users/me/github/app-webpack/node_modules/webpack/lib/NormalModuleFactory.js:42:26) webpack config: 'use strict';
var webpack = require('webpack');
module.exports = {
entry: [
'webpack/hot/dev-server',
'./src/app.js'
],
output: {
path: __dirname + '/public/build/',
filename: 'bundle.js',
publicPath: '/build/'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loaders: ['babel-loader?experimental']
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
]
};
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App Webpack</title>
</head>
<body>
<div id="app"></div>
<script src="{{mainJS}}"></script>
</body>
</html> |
This happens to me because Google Tag Manager inserts a script element at the bottom of the page and Webpack tries to replace the last script element, which no longer is the bundle... |
Get this exact error too, what @Zache said. Fixed by removing GTM in dev... |
I'm getting this when I have the redux-devtools Chrome extension active - the extension injects a script into the document which doesn't have a |
I can confirm this problem with the redux devtools chrome extension |
Because of |
We get it because we lazy load our scripts... |
👀 me too |
Same here. Seems to be related to the Update: #447 solves the issue. 👍 |
@Zache the GTM issue was never resolved, correct? I still get |
@brotzky I'm not sure, it wasn't GTM itself but rather the tags and our workaround was to remove them from our development env. |
@Zache, I think we will take the same approach. Thanks! |
I've just merged #447 – but now I think, this PR is only removing the error instead of being an actual solution to the problem. When the url can't be retrieved from the script tag, it will default to Wouldn't it be better to use |
I have faced this issue with deferred ZenDesk script injection. Looking forward to find a good solution! |
@achimnol |
@jhnns, The only problem is that So what should we do here? Do we support IE? |
I and several other members of my team are hitting this issue as well and I believe it is just because of chrome extensions that we have. It would be really great if the fix from #447 was backported to v1 even if it's only a temporary solution. Right now we are just stuck refreshing the page until it works, which is a very frustrating side effect of an otherwise amazing tool! |
This issue was fixed in PR #496. It now behaves like this:
I'm not sure about backporting this to the 1.x branch, because it can potentially break existing setups. |
Awesome! 👍 Great work! |
Released in |
Is it also fixed in |
@Braincompiler, yes, this was backported in |
Not sure if this issue is back, but I'm seeing the error
as reported by #381. This error is reported the very first time webpack HMRs. Subsequent HMRs do not cause this error to show up. Let me know if you need a repo reproducing the issue. |
Hi,
Am seeing a lot of :
Which is from here:
https://github.com/webpack/webpack-dev-server/blob/master/client/index.js#L5
As i've got script elements in my markup that don't have a src attribute.
We're using fluxible, so our HTML has inline state in a <script/> tag like: https://github.com/yahoo/flux-examples/blob/master/fluxible-router/components/Html.jsx
Thanks.
Steve
The text was updated successfully, but these errors were encountered: