umd

Import UMD Javascript Modules into Browser

随声附和 提交于 2020-01-24 12:25:59
问题 Hi I am doing some research on RxJS. I am able to use the library simply by referencing it in my browser as such: <script src="https://unpkg.com/@reactivex/rxjs@5.5.6/dist/global/Rx.js"></script> It imports with the global object namespace variable of 'Rx'. I can make observables and do all the fun stuff. Where everything breaks down is when I change the src to point to the latest UMD file like this <script src="https://unpkg.com/rxjs/bundles/rxjs.umd.js"></script> The import seems to not be

Import UMD Javascript Modules into Browser

≡放荡痞女 提交于 2020-01-24 12:24:43
问题 Hi I am doing some research on RxJS. I am able to use the library simply by referencing it in my browser as such: <script src="https://unpkg.com/@reactivex/rxjs@5.5.6/dist/global/Rx.js"></script> It imports with the global object namespace variable of 'Rx'. I can make observables and do all the fun stuff. Where everything breaks down is when I change the src to point to the latest UMD file like this <script src="https://unpkg.com/rxjs/bundles/rxjs.umd.js"></script> The import seems to not be

Webpack UMD: Critical dependency… cannot be statically extracted

别来无恙 提交于 2020-01-14 09:53:46
问题 I'm trying to build a umd library with webpack; regardless of what I do get a warning: WARNING in D:/Code/Node/sample.io/source/index.ts 3:24 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted when I try to require('./index.js') the generated index.js I get: Error: Cannot find module "." For completeness here are all my files: webpack.config.js: module.exports = { entry: { index: __dirname + '/index' }, output: { filename: 'index.js',

Compiling typescript with UMD option into a single file

大城市里の小女人 提交于 2020-01-14 09:38:07
问题 I'm working on a typescript project that uses import / export style syntax for modules. I want to compile all the typescript files into a single file. Here is how my tsconfig.json looks like, { "compilerOptions": { "module": "UMD", "noImplicitAny": false, "noUnusedLocals": false, "noUnusedParameters": false, "removeComments": true, "preserveConstEnums": true, "strictNullChecks": true, "target": "ES5", "lib": [ "es2016", "dom" ], "outFile": "dist/beetl.js" }, "include": [ "src/**/*" ],

vue源码技术点(第一天)

为君一笑 提交于 2020-01-13 13:24:53
exports.getAllBuilds = () => Object.keys(builds).map(genConfig) 函数Object.keys 会返回一个对象中所有可枚举的key,如果是数组,将会返回下标。 例如: 1.const configs = { umdDev: { format: 'umd', env: 'development' }, umdProd: { format: 'umd', env: 'production' } } console.log(Object.keys(configs));//["umdDev","umdProd"] 2.const test=["11","22","33"] console.log(Object.keys(test));//["0","1","2"] map函数 方法会返回一个数组,该方法的参数为currentValue, index,arr,. currentValue 必须。当前元素的值 index 可选。当前元素的索引值 arr 可选。当前元素属于的数组对象 process.env.TARGET process对象 node.js中进程相关的对象 是全局对象,因此你可以在code中的任何一个地方访问其对象中的属性,值都是一致的 其中包含一些和进程以及nodejs运行环境相关的一些属性

How to save reference to “this” in Vue component?

我是研究僧i 提交于 2020-01-06 02:41:08
问题 I'm not sure if I'm doing this properly. Please have a look at this simple Vue component Test.vue : <template> <div> Hi from {{name}} </div> </template> <script> let self; export default { created: function () { self = this; }, methods: { load() { ajax().then((obj) => self.name = obj.data); } }, data() { return { name: 'one', } } } </script> As you can see I'm saving the reference of this into a variable called self because the value of this changes in lambda functions , e.g. ajax().then((obj

Cannot run javascript umd command line tool: [TypeError: _.any is not a function]

时间秒杀一切 提交于 2019-12-24 12:05:06
问题 I'm just trying out urequire but cant get a simple example to work. In windows on my desktop i have a "SomeFolder" folder with a single file in it called test.js. It looks like this... define([], function() { return {the:'PersonViewModule'} }); I run the following command... c:\Users\blah\Desktop> urequire UMD SomeFolder/ -o build [uRequire/process/Bundle] ERRor: Unknown error while loading/refreshing/processing 'test.js'. error.nested = [TypeError: _.any is not a function] [uRequire

Webpack umd library return Object.default

早过忘川 提交于 2019-12-22 12:34:11
问题 I'm writing a lib with webpack with these settings: output: { path: path.join('build'), filename: 'my_lib.js', library: 'MyLib', libraryTarget: 'umd' }, MyLib: export default function() { console.log('MyLib'); } The problem is, when I try to load the build/my_lib.js in a browser, the only way to access MyLib is through MyLib.default... Any idea? 回答1: If you are asking about any idea of why? If you are using Babel to enable ES6 features then you are probably facing one of the changes between

How to create angular2 library which could be supported by all script loaders

送分小仙女□ 提交于 2019-12-21 03:53:33
问题 How can I create a javascript file that contains an Angular 2 module that can be used by other applications, but is loaded at runtime directly from a centralized server and is NOT bundled into a specific application's code? Think of this as a CDN for an Angular 2 library. The requirement is that the consumers of this library will include a single script on their page. It is a requirement to implement it this way, so I am not interested in any answers that suggest bundling the library into the

UMD javascript module which also works in strict mode

≯℡__Kan透↙ 提交于 2019-12-13 02:15:02
问题 I'm having trouble rewriting this to work in 'strict' mode. Since 'this' is not defined explicitly I'm getting jshint errors on compile. I'm thinking my brain is just not thinking abstractly enough to find a creative solution. Any help would be appreciated. Code adapted from the Universal Module Definition Github repo: https://github.com/umdjs/umd/blob/master/returnExports.js (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD Module define([], factory); }