search

Home  >  Q&A  >  body text

javascript - es6 import import problem

Isn’t the import of es6 importing something exposed by export or export default? Why can styl be imported directly through import when writing a stylus file in webpack?

迷茫迷茫2753 days ago447

reply all(1)I'll reply

  • 迷茫

    迷茫2017-05-18 11:04:00

    ES6 Module 导入方式仅对 js 文件有效。其他类型的文件,Webpack 通过 loader 插件处理后导入。

    Loader: Loaders are transformations that are applied on the source code of a module. They allow you to preprocess files as you require() or “load” them. Thus, loaders are kind of like “tasks” in other build tools, and provide a powerful way to handle front-end build steps. Loaders can transform files from a different language (like TypeScript) to JavaScript, or inline images as data URLs. Loaders even allow you to do things like require() CSS files right in your JavaScript!

    webpack loader

    reply
    0
  • Cancelreply