Webpack does not recognize JS or CSS outside the SRC directory when it is packaged and compiled

Source: Internet
Author: User
Tags i18n

The front-end of the DVA project development, encountered a very depressed problem, with ES6 syntax simple export a variable out, in other JS import use, the result is an error. The export is written as follows:
1 Const Enus = {2account: ' Account   : ',3   password: ' Password: '  ,4   userlogin: "User Login"5}; 6 default Enus;
It doesn't seem to be a problem, does it? Import is written as follows:
1 import Enus from '. /.. /i18n/enus ';
It doesn't seem to be a problem, does it? However, in other JS in the import use will be error, the following errors:uncaught syntaxerror:unexpected Token exportReason: Check for half a day, the last discovery is because i18n file directory is not correct, this must be placed in the project SRC directory, otherwise webpack will not be recognized. Good pit.

Webpack does not recognize JS or CSS outside the SRC directory when it is packaged and compiled

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.