Uh oh!
There was an error while loading. Please reload this page.
fix(client): add default fallback for client - #2015
Conversation
Codecov Report
@@ Coverage Diff @@## master #2015 +/- ##
=======================================
Coverage 92.77% 92.77% =======================================
Files 29 29 Lines 1149 1149 Branches 327 327 =======================================
Hits 1066 1066 Misses 79 79 Partials 4 4Continue to review full report at Codecov.
|
| // this SockJSClient is here as a default fallback, in case inline mode | ||
| // is off or the client is not injected. This will be switched to | ||
| // WebsocketClient when it becomes the default | ||
| const SockJSClient = require('../clients/SockJSClient'); |
hiroppy
commented
Jun 11, 2019
We should release as a patch version asap. Thanks. |
knagaitsev
commented
Jun 12, 2019
@evilebottnawi Looks good? |
alexander-akait
left a comment
There was a problem hiding this comment.
Good job, some notes and question
| // eslint-disable-next-line global-require | ||
| const SockJSClient = require('../clients/SockJSClient'); | ||
| Client = SockJSClient; | ||
| } |
There was a problem hiding this comment.
Maybe more simple? Like:
const Client = typeof __webpack_dev_server_client__ !== 'undefined' ? __webpack_dev_server_client__ : require('../clients/SockJSClient');
| const sockPort = options.sockPort ? `&sockPort=${options.sockPort}` : ''; | ||
| const clientEntry = `${require.resolve( | ||
| '../../client/' | ||
| '../../client/default/' |
There was a problem hiding this comment.
Breaking change, some packages can use this directly, so changing path can break these apps
| "pretest": "npm run lint", | ||
| "prepare": "rimraf ./ssl/*.pem && npm run build:client", | ||
| "build:client:default": "babel client-src/default --out-dir client --ignore \"./client-src/default/*.config.js\"", | ||
| "build:client:default": "babel client-src/default --out-dir client/default --ignore \"./client-src/default/*.config.js\"", |
There was a problem hiding this comment.
Breaking change, as i written above
knagaitsev
commented
Jun 13, 2019
@evilebottnawi any ideas how to make |
alexander-akait
commented
Jun 13, 2019
@Loonride hm, we already keep clients in difference directory, can't see problem |
The problem is the directory organization of When And we need both to work, because it needs to be functional in the babel transpiled |
alexander-akait
commented
Jun 13, 2019
Good catch, i think we can change location and create What do you think? |
knagaitsev
commented
Jun 13, 2019
That is a good idea, let me push an alternative solution that I just made though which may be simpler and we can compare. |
knagaitsev
commented
Jun 13, 2019
@evilebottnawi my idea is to use |
knagaitsev
commented
Jun 14, 2019
@evilebottnawi thoughts? |
knagaitsev
commented
Jun 17, 2019
@evilebottnawi@hiroppy Could you take a look so we can resolve this issue? |
Uh oh!
There was an error while loading. Please reload this page.
| to: path.resolve(__dirname, '../../client/live.html'), | ||
| }, | ||
| ]), | ||
| new webpack.NormalModuleReplacementPlugin(/\/clients\//, (resource) => { |
There was a problem hiding this comment.
memo: We will delete this plugin at the next major version because we can change the directory structure.
hiroppy
commented
Jun 17, 2019
I'll release today. thanks! |
alexander-akait
commented
Jun 18, 2019
We should do regexp more strictly now all clients directories in requests rewrites in all modules, i.e. if package use clients directory we rewrite their import/require too, it is very very very big problem, I have many issues about this in DM gutter and other channels and I don't access to fix it right now, please guys take care about it asap, it is incredibly high priority |
@evilebottnawi Would you want to revert? We should add the state actually used by userland to the test. |
knagaitsev
commented
Jun 18, 2019
@evilebottnawi Sorry about that, I did not think it would impact other modules. @hiroppy I say revert, then we follow the other method that @evilebottnawi suggested |
For Bugs and Features; did you add new tests?
Not yet, probably should resolve asap
Motivation / Use-Case
Fixes#2006 by providing a default fallback in case
__webpack_dev_server_client__is undefined.I moved the
defaultclient sources toclient/defaultso that the file path structure is the same, allowingsocket.jstorequire('../clients/SockJSClient')in bothclientandclient-srcBreaking Changes
None
Additional Info
We still need to figure out how to insert
__webpack_dev_server_client__variable intolivemode.