We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build to umd which one can AMD or commons use require or import .
import _ from 'lodash'; import numRef from './ref.json'; export function numToWord(num) { return _.reduce(numRef, (accum, ref) => { return ref.num === num ? ref.word : accum; }, ''); }; export function wordToNum(word) { return _.reduce(numRef, (accum, ref) => { return ref.word === word && word.toLowerCase() ? ref.num : accum; }, -1); };
{ "name": "webpack-numbers", "version": "1.0.0", "main": "dist/webpack-numbers.js", // 生成包路径 "module": "src/index.js", // 用于支持es6的浏览器实验性选项 "license": "MIT", "devDependencies": { "lodash": "^4.17.10", "webpack": "^4.17.2", "webpack-cli": "^3.1.0" } }
var path = require("path"); module.exports = { entry: "./src/index.js", mode: "production", // 生产用 output: { path: path.resolve(__dirname, "dist"), filename: "webpack-numbers.js",// 最后生成的包文件名 library: "webpackNumbers", // 用于 libraryTarget: "umd" //指定打包类型 }, externals: { // 以来第三方包 lodash: { commonjs: "lodash", commonjs2: "lodash", amd: "lodash", root: "_" } } };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
build to umd which one can AMD or commons use require or import .
The text was updated successfully, but these errors were encountered: