Giter VIP home page Giter VIP logo

Comments (25)

Vito2102 avatar Vito2102 commented on August 25, 2024 1

"module": "commonjs" have to be set in source code of linq-es2015 before build.

If you want quick fix, you can change linq.js (and the same way other js files) in lib folder:

(function (factory) { if (typeof module === 'object' && typeof module.exports === 'object') { var v = factory(exports); if (v !== undefined) module.exports = v; } else if (typeof define === 'function' && define.amd) { define(["require", "exports", "./generators", "./utilities", "./iterators"], factory); } })(function (exports) { (remove require from function parameters)

from linq.

ENikS avatar ENikS commented on August 25, 2024

Your description of the problem does not make any sense to me. What module, where failing, why webpack and how is it being used? Would you care to provide more context, perhaps even code sample...

from linq.

bastienJS avatar bastienJS commented on August 25, 2024

I have cleaned up the chaotic question, hope its more clear now.

from linq.

ENikS avatar ENikS commented on August 25, 2024

Have you looked at this example?
https://github.com/ENikS/LINQ/tree/examples/Angular

Can you create a repo and upload your project there so I can look at it?

from linq.

bastienJS avatar bastienJS commented on August 25, 2024

Yes I had a quick look at that link but then I saw its for systemJS which I do not use. For sure I will create a repo on github where I put the minimum stuff to get you going :-)

from linq.

bastienJS avatar bastienJS commented on August 25, 2024

https://github.com/bastienJS/linqmoduletest

Do

  1. 'npm install' to install locally all node modules.
  2. 'npm start' :-)
  3. See the error in the console output

from linq.

ENikS avatar ENikS commented on August 25, 2024

Will have to do some research...

from linq.

bastienJS avatar bastienJS commented on August 25, 2024

Hello Eugene, any news on that feature request? I have birthday on 20th october ;-)

from linq.

Vito2102 avatar Vito2102 commented on August 25, 2024

It could be fixed by changing module in tsconfig.json from umd to commonjs.

from linq.

bastienJS avatar bastienJS commented on August 25, 2024

My setting was on ES6 and I tried to commonjs: "module": "commonjs",
but I get the same error message! although the exception happens now in mainbundle.js file not linqjs file:

here:
'''
var v = factory(!(function webpackMissingModule() { var e = new Error("Cannot find module ".""); e.code = 'MODULE_NOT_FOUND'; throw e; }()), exports); if (v !== undefined) module.exports = v;
'''
Great linq might work but my application does not start anymore haha ;-)

from linq.

bastienJS avatar bastienJS commented on August 25, 2024

@Vito2102 Why don`t you make a pull request for this? That would be great!

from linq.

ENikS avatar ENikS commented on August 25, 2024

I do not think manual change of compiled files constitutes a good solution. I am researching AMD loader as solution but unfortunately don't have enough time for it.

from linq.

Vito2102 avatar Vito2102 commented on August 25, 2024

@ENikS Why you use in configuration module: umd and not module: commonjs?

from linq.

ENikS avatar ENikS commented on August 25, 2024

In Node it is configured as UMD (tsconfig.json) and compiled into lib dir. Browserified UMD module is compiled into ./dist directory to be used in UI. I am still trying to understand why webpack is not picking up at least one of these.
UMD should be digestible by both Node and Browser. I have feeling it is simply not finding it.

from linq.

ENikS avatar ENikS commented on August 25, 2024

@bastienJS Could you try to remove this line from angular-cli.json:

 "scripts": ["../node_modules/linq-es2015/dist/linq.js"],

and try to run it again?
Or perhaps change it into:

 "scripts": ["../node_modules/linq-es2015/lib/linq.js"],

from linq.

Vito2102 avatar Vito2102 commented on August 25, 2024

If you compile lib as commonjs, you don't need to add to angular-cli.json and it is working in angular cli.

from linq.

Vito2102 avatar Vito2102 commented on August 25, 2024

I just have some problem with uglify, when build as production.

from linq.

ENikS avatar ENikS commented on August 25, 2024

With "scripts": [], I can see linq-2015 is imported alone with angular-core in main.bandle.js:

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_linq_es2015__ = __webpack_require__(587);
...

I am unable to verify it on the browser at the moment but as far as processing by Webpack I see no issues.

from linq.

Vito2102 avatar Vito2102 commented on August 25, 2024

You tried it with angular cli?

from linq.

ENikS avatar ENikS commented on August 25, 2024

https://github.com/ENikS/linqmoduletest

https://ide.c9.io/eniks/webpack-cloned
https://preview.c9users.io/eniks/webpack-cloned

from linq.

ENikS avatar ENikS commented on August 25, 2024

I've pushed latest to the repo. You should be able to check out and test.

from linq.

bastienJS avatar bastienJS commented on August 25, 2024

@ENikS To the https://github.com/ENikS/linqmoduletest Repo ? If yes all I see there is that you removed the scripts Array content. I did that long before on my local app but I get the same exception during runtime: can not find module . in lin.js Or do I miss something?

from linq.

ENikS avatar ENikS commented on August 25, 2024

It seems that Webpack only understands commonjs modules. Perhaps there are ways to load UMD modules as well but I did not find it. So I changed module type to commonjs and it fixed the problem.

from linq.

bastienJS avatar bastienJS commented on August 25, 2024

When I change the tsconfig.ts => module: 'commonjs' then it works only with your linq-es2015 version 2.4.12 but not with 2.4.10 ??? I thought you have not changed anything concerning this feature? As I miss a changelog with versions I can not easily check what has changed, but maybe you know... thanks for investigating.

from linq.

ENikS avatar ENikS commented on August 25, 2024

Yes, I fixed it in 2.4.12 so the lest should work with the Webpack

from linq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.