Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does amdclean supports requirejs' config-map? #85

Closed
kusmierz opened this issue Mar 17, 2015 · 3 comments
Closed

Does amdclean supports requirejs' config-map? #85

kusmierz opened this issue Mar 17, 2015 · 3 comments

Comments

@kusmierz
Copy link

@see http://requirejs.org/docs/api.html#config-map

ie:

    'map': {
        '*': {
            'jquery': 'zepto'
        },
        'foo/bar': {
            'abc': 'def'
        }
    },

I guess it doesn't or I'm doing something wrong...

@juansilva
Copy link

I was about to create the same issue :(

@gfranko
Copy link
Owner

gfranko commented Apr 2, 2015

I believe this is an r.js issue...

@kusmierz
Copy link
Author

So I've following config:

({
    'name': 'foo/main',
    'out': '../build/foo.min.js',
    // just for debug
    'optimize': 'none',
    'mainConfigFile': 'foo.js',
    'include': [],
    'insertRequire': ['foo/main'],
    'optimizeAllPluginResources': true,
    // stubModules can be used to remove unneeded plugins after build
    'stubModules': ['text', 'async', 'font', 'jsn', 'propertyParser', 'normalize', 'css-builder'],
    'onModuleBundleComplete': function (data) {
        module.paths.push('./node_modules');
        try {
            var fs = module.require('fs'),
                amdclean = module.require('amdclean'),
                outputFile = data.path,
                cleanedCode = amdclean.clean({
                    'filePath': outputFile
                });

            fs.writeFileSync(outputFile, cleanedCode);
        } catch (e) {
            console.info(e.message);
        }
    }
});

as far as I understand, I have to include config file (require.config) into my build file. Is it enough to pu there mainConfigFile? Could you, @gfranko help us to create stub build.js file for requirejs with maps? Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants