ASP.NET MVC 5 Bundler considered import statements?












0














I have the question referring to the bundler in ASP.Net MVC 5.



As I know you can use the bundler for bundling and minification. Currently I work on a vue-tempate and I have a lot of import statetments at the beginning like:



import Vue form "vue";


So my question is does the bundler resolve this import statement in the finale output file? So that I dont have to include



<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>


I haven't found a clear answer on Google.



Currently I use webpack to achieve this, but I was wondering if this is really necessary.



Please note this has nothing to do which approach is better I just want to know if the standard bundler is able to do the same.










share|improve this question
























  • Have you tried it? Turn on bundling and see what the output contains.
    – freedomn-m
    Nov 19 '18 at 13:43










  • @freedomn-m in my test it dont do it out of the box. But I thought maybe you have to configure somehting else to achive this.
    – Darem
    Nov 19 '18 at 14:01
















0














I have the question referring to the bundler in ASP.Net MVC 5.



As I know you can use the bundler for bundling and minification. Currently I work on a vue-tempate and I have a lot of import statetments at the beginning like:



import Vue form "vue";


So my question is does the bundler resolve this import statement in the finale output file? So that I dont have to include



<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>


I haven't found a clear answer on Google.



Currently I use webpack to achieve this, but I was wondering if this is really necessary.



Please note this has nothing to do which approach is better I just want to know if the standard bundler is able to do the same.










share|improve this question
























  • Have you tried it? Turn on bundling and see what the output contains.
    – freedomn-m
    Nov 19 '18 at 13:43










  • @freedomn-m in my test it dont do it out of the box. But I thought maybe you have to configure somehting else to achive this.
    – Darem
    Nov 19 '18 at 14:01














0












0








0







I have the question referring to the bundler in ASP.Net MVC 5.



As I know you can use the bundler for bundling and minification. Currently I work on a vue-tempate and I have a lot of import statetments at the beginning like:



import Vue form "vue";


So my question is does the bundler resolve this import statement in the finale output file? So that I dont have to include



<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>


I haven't found a clear answer on Google.



Currently I use webpack to achieve this, but I was wondering if this is really necessary.



Please note this has nothing to do which approach is better I just want to know if the standard bundler is able to do the same.










share|improve this question















I have the question referring to the bundler in ASP.Net MVC 5.



As I know you can use the bundler for bundling and minification. Currently I work on a vue-tempate and I have a lot of import statetments at the beginning like:



import Vue form "vue";


So my question is does the bundler resolve this import statement in the finale output file? So that I dont have to include



<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>


I haven't found a clear answer on Google.



Currently I use webpack to achieve this, but I was wondering if this is really necessary.



Please note this has nothing to do which approach is better I just want to know if the standard bundler is able to do the same.







asp.net-mvc vue.js webpack






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 13:43









freedomn-m

11.9k31842




11.9k31842










asked Nov 19 '18 at 12:27









Darem

4071319




4071319












  • Have you tried it? Turn on bundling and see what the output contains.
    – freedomn-m
    Nov 19 '18 at 13:43










  • @freedomn-m in my test it dont do it out of the box. But I thought maybe you have to configure somehting else to achive this.
    – Darem
    Nov 19 '18 at 14:01


















  • Have you tried it? Turn on bundling and see what the output contains.
    – freedomn-m
    Nov 19 '18 at 13:43










  • @freedomn-m in my test it dont do it out of the box. But I thought maybe you have to configure somehting else to achive this.
    – Darem
    Nov 19 '18 at 14:01
















Have you tried it? Turn on bundling and see what the output contains.
– freedomn-m
Nov 19 '18 at 13:43




Have you tried it? Turn on bundling and see what the output contains.
– freedomn-m
Nov 19 '18 at 13:43












@freedomn-m in my test it dont do it out of the box. But I thought maybe you have to configure somehting else to achive this.
– Darem
Nov 19 '18 at 14:01




@freedomn-m in my test it dont do it out of the box. But I thought maybe you have to configure somehting else to achive this.
– Darem
Nov 19 '18 at 14:01












1 Answer
1






active

oldest

votes


















1














Mix MVC and framework JS is ever hard to know on what you include between server side and client side.



If you are using App_Start/BundleConfig, you can create a virtual path to reference in _Layout the framework once as this example :



        bundles.Add(new Bundle("~/bundles/vue").Include(
"~/Scripts/lib/vue/vue.min.js",
"~/Scripts/lib/vue/vue-resource.min.js",
"~/Scripts/lib/vue/vue-router.js",
"~/Scripts/lib/vue/vue-mask.js",
"~/Scripts/lib/vue/v-calendar.min.js",
"~/Scripts/lib/vue/vue-config.js"
));


You can import your Vue each time it is necessary, and webpack would be produce the same bundle as your example shown.



If the issue is only <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script> in each template view, then you can add this on _Layout and using https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js






share|improve this answer























  • thx for the anwser. So I guess the bundler is not able to resolve the import statements, so this is the best solution.
    – Darem
    Nov 20 '18 at 6:33










  • No, the MVC bundler produce only virtual path to minified files.
    – User.Anonymous
    Nov 20 '18 at 9:16










  • Ok nice you solve my problem thx very much!
    – Darem
    Nov 20 '18 at 9:17











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53374639%2fasp-net-mvc-5-bundler-considered-import-statements%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Mix MVC and framework JS is ever hard to know on what you include between server side and client side.



If you are using App_Start/BundleConfig, you can create a virtual path to reference in _Layout the framework once as this example :



        bundles.Add(new Bundle("~/bundles/vue").Include(
"~/Scripts/lib/vue/vue.min.js",
"~/Scripts/lib/vue/vue-resource.min.js",
"~/Scripts/lib/vue/vue-router.js",
"~/Scripts/lib/vue/vue-mask.js",
"~/Scripts/lib/vue/v-calendar.min.js",
"~/Scripts/lib/vue/vue-config.js"
));


You can import your Vue each time it is necessary, and webpack would be produce the same bundle as your example shown.



If the issue is only <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script> in each template view, then you can add this on _Layout and using https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js






share|improve this answer























  • thx for the anwser. So I guess the bundler is not able to resolve the import statements, so this is the best solution.
    – Darem
    Nov 20 '18 at 6:33










  • No, the MVC bundler produce only virtual path to minified files.
    – User.Anonymous
    Nov 20 '18 at 9:16










  • Ok nice you solve my problem thx very much!
    – Darem
    Nov 20 '18 at 9:17
















1














Mix MVC and framework JS is ever hard to know on what you include between server side and client side.



If you are using App_Start/BundleConfig, you can create a virtual path to reference in _Layout the framework once as this example :



        bundles.Add(new Bundle("~/bundles/vue").Include(
"~/Scripts/lib/vue/vue.min.js",
"~/Scripts/lib/vue/vue-resource.min.js",
"~/Scripts/lib/vue/vue-router.js",
"~/Scripts/lib/vue/vue-mask.js",
"~/Scripts/lib/vue/v-calendar.min.js",
"~/Scripts/lib/vue/vue-config.js"
));


You can import your Vue each time it is necessary, and webpack would be produce the same bundle as your example shown.



If the issue is only <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script> in each template view, then you can add this on _Layout and using https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js






share|improve this answer























  • thx for the anwser. So I guess the bundler is not able to resolve the import statements, so this is the best solution.
    – Darem
    Nov 20 '18 at 6:33










  • No, the MVC bundler produce only virtual path to minified files.
    – User.Anonymous
    Nov 20 '18 at 9:16










  • Ok nice you solve my problem thx very much!
    – Darem
    Nov 20 '18 at 9:17














1












1








1






Mix MVC and framework JS is ever hard to know on what you include between server side and client side.



If you are using App_Start/BundleConfig, you can create a virtual path to reference in _Layout the framework once as this example :



        bundles.Add(new Bundle("~/bundles/vue").Include(
"~/Scripts/lib/vue/vue.min.js",
"~/Scripts/lib/vue/vue-resource.min.js",
"~/Scripts/lib/vue/vue-router.js",
"~/Scripts/lib/vue/vue-mask.js",
"~/Scripts/lib/vue/v-calendar.min.js",
"~/Scripts/lib/vue/vue-config.js"
));


You can import your Vue each time it is necessary, and webpack would be produce the same bundle as your example shown.



If the issue is only <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script> in each template view, then you can add this on _Layout and using https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js






share|improve this answer














Mix MVC and framework JS is ever hard to know on what you include between server side and client side.



If you are using App_Start/BundleConfig, you can create a virtual path to reference in _Layout the framework once as this example :



        bundles.Add(new Bundle("~/bundles/vue").Include(
"~/Scripts/lib/vue/vue.min.js",
"~/Scripts/lib/vue/vue-resource.min.js",
"~/Scripts/lib/vue/vue-router.js",
"~/Scripts/lib/vue/vue-mask.js",
"~/Scripts/lib/vue/v-calendar.min.js",
"~/Scripts/lib/vue/vue-config.js"
));


You can import your Vue each time it is necessary, and webpack would be produce the same bundle as your example shown.



If the issue is only <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script> in each template view, then you can add this on _Layout and using https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 19 '18 at 16:08

























answered Nov 19 '18 at 16:02









User.Anonymous

1,00911539




1,00911539












  • thx for the anwser. So I guess the bundler is not able to resolve the import statements, so this is the best solution.
    – Darem
    Nov 20 '18 at 6:33










  • No, the MVC bundler produce only virtual path to minified files.
    – User.Anonymous
    Nov 20 '18 at 9:16










  • Ok nice you solve my problem thx very much!
    – Darem
    Nov 20 '18 at 9:17


















  • thx for the anwser. So I guess the bundler is not able to resolve the import statements, so this is the best solution.
    – Darem
    Nov 20 '18 at 6:33










  • No, the MVC bundler produce only virtual path to minified files.
    – User.Anonymous
    Nov 20 '18 at 9:16










  • Ok nice you solve my problem thx very much!
    – Darem
    Nov 20 '18 at 9:17
















thx for the anwser. So I guess the bundler is not able to resolve the import statements, so this is the best solution.
– Darem
Nov 20 '18 at 6:33




thx for the anwser. So I guess the bundler is not able to resolve the import statements, so this is the best solution.
– Darem
Nov 20 '18 at 6:33












No, the MVC bundler produce only virtual path to minified files.
– User.Anonymous
Nov 20 '18 at 9:16




No, the MVC bundler produce only virtual path to minified files.
– User.Anonymous
Nov 20 '18 at 9:16












Ok nice you solve my problem thx very much!
– Darem
Nov 20 '18 at 9:17




Ok nice you solve my problem thx very much!
– Darem
Nov 20 '18 at 9:17


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53374639%2fasp-net-mvc-5-bundler-considered-import-statements%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith