-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Prepend webpack rules with webpackConfig to catch .vue.html
files
#13032
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
I don't have much familiarity with Vue, but I would encourage you to submit a pull request so that we can try your changes and see if anything is broken as a result. Thanks! |
@matthewturk would you mind trying the following ordering for merge:
It seems that indeed as the rules on all html file is the most generic, it should be the latest. And if someone is overriding that rule with another loader, it will never be called as rules are tried in order (hence the error you are seeing). If it works with this suggestion, then that will definitely make a good bug fix PR for this issue. |
This changes the webpackConfig merge order to allow it to pre-empt the rule for .html files. Closes jupyterlab#13032.
@fcollonval @jweill-aws thank you for the suggestions! As noted in the log, I've issued a PR (#13040) with the changes suggested by @fcollonval. I was not sure how to appropriately credit you for the suggested change and I'd be happy to edit the pull request to do so if you have a suggestion for how! |
* Reorder of webpackConfig merge This changes the webpackConfig merge order to allow it to pre-empt the rule for .html files. Closes #13032. * Update builder/src/extensionConfig.ts Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Problem
I'm attempting to build a jupyterlab extension that utilizes VueJS SFCs in the form of
.vue
files. My understanding -- which, I confess freely, may not be complete or total -- is that the most straightforward way to integrate these in the extension is to have webpack manage them usingvue-loader
. I've used thejupyterlab.webpackConfig
key inpackage.json
to supply an alternate set of rules, specifically:What
vue-loader
seems to do, however, is to verify that a loader works if it's able to match.vue.html
such that the first rule to hit is the one that hasloader: 'vue-loader'
. If it doesn't, we get this nice error message:I believe that this is because
extensionConfig.ts
merges in the orderbaseConfig
, then the custom one that includes.html
mapping tofile-loader
, and thenwebpackConfig
. This means that the first rule to match on.vue.html
would be thefile-loader
, which thenvue-loader
isn't pleased with.I'm not entirely sure if my use case is unreasonable here, but it would be very nice to be able to preempt the
file-loader
rule somehow to makevue-loader
happy. For instance, reordering (in https://github.com/jupyterlab/jupyterlab/blob/3.4.x/builder/src/extensionConfig.ts#L253 ) succeeds at fixing this specific problem:but I am wary that this will break other use cases.
Would it be possible to provide a second key, or otherwise specify the order of
merge
-ing, so that the vue rule is first? (I'm happy to submit a PR to do this, but felt asking first might work better.)The text was updated successfully, but these errors were encountered: