Git Product home page Git Product logo

Comments (4)

vonagam avatar vonagam commented on August 12, 2024 3

For reference, here is a basic rollup config for ECMAScript project:

import globby from 'globby';
import del from 'rollup-plugin-delete';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';

const input = {};
for (const file of globby.sync('**/*.{jsx,tsx}', {cwd: './sources'})) {
  input[file.replace(/\.(jsx|tsx)$/, '')] = `sources/${file}`;
}

export default {
  input,
  output: {
    dir: '../js.build',
    entryFileNames: '[name].jsx',
    chunkFileNames: '.chunks/[name]-[hash].js',
    format: 'es',
    sourcemap: true,
    sourcemapExcludeSources: true,
  },
  plugins: [
    del({targets: '../js.build', force: true, runOnce: true}),
    resolve(),
    commonjs(),
    typescript(),
  ],
};

For a structure like this to work:

js/
  node_modules/
  sources/ - folder with sources
  .gdignore
  package.json
  rollup.config.js
  tsconfig.json
js.build/ - folder with build files which are used by godot 

It needs addition of following packages:

@rollup/plugin-commonjs
@rollup/plugin-node-resolve
@rollup/plugin-typescript
globby
rollup
rollup-plugin-delete
tslib

And in package.json, initial scripts are replaced with those:

"watch": "rollup --config --watch",
"compile": "rollup --config"

from ecmascript.

Geequlim avatar Geequlim commented on August 12, 2024

Feel free to using webpack
The node module is mostly for development usage.

from ecmascript.

vonagam avatar vonagam commented on August 12, 2024

I mean that maybe a basic setup/config for some bundler (webpack, rollup or other) can be included with Generate TypeScript Project.

Those issues with resolution, ignoring, exporting do apply to every project, they are not project specific.

Or do you think that this is out of scope?

from ecmascript.

Geequlim avatar Geequlim commented on August 12, 2024

I think we only need to ensure the functions of the core language binding. As for the use and selection of third-party libraries and tool chains, it should be left to its users. Of course, we can specify the design intent of which features in the document.

For node modules, its design intent is to quickly test third-party libraries, rather than directly releasing them into products. No one wants to bring a huge black hole when the game is released.

from ecmascript.

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.