Skip to content

Add AMD/RequireJS support with UMD wrapper#1079

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/add-amd-support
Draft

Add AMD/RequireJS support with UMD wrapper#1079
Copilot wants to merge 4 commits intomasterfrom
copilot/add-amd-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 4, 2026

Adds AMD module loading support via separate build outputs using a UMD wrapper.

Changes

  • New build task: build-amd in gulpfile.mjs generates jsvalidation.amd.js and minified variant
  • UMD wrapper: Supports AMD, CommonJS, and browser globals with jQuery dependency declaration
  • Module export: laravelValidation accessible via $.laravelValidation in addition to global scope
  • Build integration: npm run build now generates both standard and AMD outputs

Usage

requirejs.config({
    paths: {
        'jquery': 'path/to/jquery',
        'jsvalidation': 'vendor/jsvalidation/js/jsvalidation.amd'
    }
});

requirejs(['jsvalidation'], function($) {
    // Use $.laravelValidation or window.laravelValidation
    {!! JsValidator::formRequest('App\Http\Requests\MyFormRequest') !!}
});

Size overhead: 0.58 KB (0.20%). Original build unchanged for backward compatibility.

Original prompt

This section details on the original issue you should resolve

<issue_title>Can you provide support for AMD ?</issue_title>
<issue_description></issue_description>

<agent_instructions>Add support for loading via AMD (requireJS). Integrate the solution into the existing build configuration (webpack).</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@bytestream AMD? @bytestream You're welcome to send a PR which updates https://github.com/proengsoft/laravel-jsvalidation/blob/master/gulpfile.mjs to provide a separate build file for AMD.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 4, 2026 22:43
Co-authored-by: bytestream <1788397+bytestream@users.noreply.github.com>
Co-authored-by: bytestream <1788397+bytestream@users.noreply.github.com>
Co-authored-by: bytestream <1788397+bytestream@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for AMD loading via requireJS Add AMD/RequireJS support with UMD wrapper Feb 4, 2026
Copilot AI requested a review from bytestream February 4, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can you provide support for AMD ?

2 participants