Giter VIP home page Giter VIP logo

Comments (4)

lukebarlow avatar lukebarlow commented on May 18, 2024 1

I'm not sure if this is exactly what you're after, but I've got yjs working with babel and webpack, and thought I'd share the configuration in case that's useful, so it's here

https://github.com/lukebarlow/yjs-jigsaw-es6-imports

from yjs.

lukebarlow avatar lukebarlow commented on May 18, 2024 1

Yes, but probably they can be got rid of with some small tweaks to the yjs code. Here's the error messages that pop up without those lines, in case that's helpful.

WARNING in ./~/yjs/src/Notes.md
Module parse failed: /Projects/fork/yjs-jigsaw-es6-imports/node_modules/yjs/src/Notes.md Unexpected character '#' (2:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '#' (2:0)
    at Parser.pp$4.raise (/Projects/fork/yjs-jigsaw-es6-imports/node_modules/acorn/dist/acorn.js:2221:15)
    at Parser.pp$7.getTokenFromCode (/Projects/fork/yjs-jigsaw-es6-imports/node_modules/acorn/dist/acorn.js:2756:10)
    at Parser.pp$7.readToken (/Projects/fork/yjs-jigsaw-es6-imports/node_modules/acorn/dist/acorn.js:2477:17)
    at Parser.pp$7.nextToken (/Projects/fork/yjs-jigsaw-es6-imports/node_modules/acorn/dist/acorn.js:2468:15)
    at Parser.parse (/Projects/fork/yjs-jigsaw-es6-imports/node_modules/acorn/dist/acorn.js:515:10)
    at Object.parse (/Projects/fork/yjs-jigsaw-es6-imports/node_modules/acorn/dist/acorn.js:3098:39)
    at Parser.parse (/Projects/fork/yjs-jigsaw-es6-imports/node_modules/webpack/lib/Parser.js:902:15)
    at DependenciesBlock.<anonymous> (/Projects/fork/yjs-jigsaw-es6-imports/node_modules/webpack/lib/NormalModule.js:104:16)
    at DependenciesBlock.onModuleBuild (/Projects/fork/yjs-jigsaw-es6-imports/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
    at nextLoader (/Projects/fork/yjs-jigsaw-es6-imports/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
    at /Projects/fork/yjs-jigsaw-es6-imports/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
    at Storage.finished (/Projects/fork/yjs-jigsaw-es6-imports/node_modules/webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
    at /Projects/fork/yjs-jigsaw-es6-imports/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:439:3)
 @ ./~/yjs/src ^\.\/.*$

ERROR in ./~/yjs/src/SpecHelper.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../../y-indexeddb/src/IndexedDB.js in /Projects/fork/yjs-jigsaw-es6-imports/node_modules/yjs/src
 @ ./~/yjs/src/SpecHelper.js 13:0-45

ERROR in ./~/yjs/src/SpecHelper.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../../y-leveldb/src/LevelDB.js in /Projects/fork/yjs-jigsaw-es6-imports/node_modules/yjs/src
 @ ./~/yjs/src/SpecHelper.js 15:2-43

ERROR in ./~/yjs/src/SpecHelper.js
Module not found: Error: Cannot resolve module 'seedrandom' in /Projects/fork/yjs-jigsaw-es6-imports/node_modules/yjs/src
 @ ./~/yjs/src/SpecHelper.js 30:18-39

from yjs.

dmonad avatar dmonad commented on May 18, 2024

In nodejs it is likely that the file extention .mjs will be used to recognize es2015 modules. In the future, this will be preferred as the file-extention for es2015 modules. See here

Rollup.js is currently lobbying for the package-entry jsnext:main for all libraries. I plan to use rollup for the build-process in the next version of Yjs. The package.json will look like this:

{ ..
  "main": "y.js",
  "jsnext:main": "y.mjs",
}

This, hopefully, also resolves the broccoli problems.

from yjs.

dmonad avatar dmonad commented on May 18, 2024

This will be really helpful to others using webpack, thanks! I haven't used Webpack yet. I'll give it a try next week. Is this really necessary?:

plugins: [
  new webpack.IgnorePlugin(/SpecHelper/),
  new webpack.IgnorePlugin(/.*\.md/),
]

from yjs.

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.