Browseify - 在捆绑的 browserify 文件中使用函数?

问题描述

我已经捆绑了我的 javascript 文件以使用 require 关键字,但是我无法在捆绑文件调用我的任何函数。我已经查看了论坛,但没有适合我的问题的解决方案。这是一些示例代码,可为您提供良好的形象。

示例代码

main.js:
const yahoostockprices = require('yahoo-stock-prices');

function getprice()
{
 yahoostockprices.getCurrentPrice('AAPL);
}

编译代码

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
...

错误

getPrice function is not defined

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)