es6的import导入的问题

es6的import导入的不是export或者export default暴露出来的东西吗,为什么在webpack中写stylus文件styl也可以直接通过import导入?

冉冉说
浏览 741回答 1
1回答

缥缈止盈

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
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript