demo01 最简单的 webpack 零配置实践

栏目: JavaScript · 发布时间: 6年前

内容简介:webpack4 支持零配置打包(无需 webpack.config.js 配置文件),首先我们可以直接运行在 demo01 目录下新建 hello.js 和 index.jshello.js

webpack4 支持零配置打包(无需 webpack.config.js 配置文件),首先我们可以直接运行 webpack index.js (入口index.js)进行编译打包。

2.目录结构

在 demo01 目录下新建 hello.js 和 index.js

// `--` 代表目录, `-` 代表文件
--demo01
  --src
    -hello.js
    -index.js
复制代码

hello.js

export function sayHello() {
  console.log('hello world!');
}
复制代码

index.js

import { sayHello } from './hello';
sayHello();
复制代码

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Letting Go of the Words

Letting Go of the Words

Janice (Ginny) Redish / Morgan Kaufmann / 2007-06-11 / USD 49.95

"Redish has done her homework and created a thorough overview of the issues in writing for the Web. Ironically, I must recommend that you read her every word so that you can find out why your customer......一起来看看 《Letting Go of the Words》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具