gfranko / amdclean

A build tool that converts AMD code to standard JavaScript
http://gregfranko.com/amdclean/
MIT License
449 stars 37 forks source link

google-code-prettify isn't being added to the global variables #63

Open lookfirst opened 10 years ago

lookfirst commented 10 years ago

I've installed via bower: "google-code-prettify": "~1.0.3",

When I run things through amdclean, this is the only module that isn't being found.

I can see that the require('google-code-prettify') gets converted to just a variable of 'google_code_prettify;', but this variable isn't referenced at the top of the file like the other requires are.

Here is how I'm using amdclean (and the hacky workaround for now):

    requirejs.optimize({
        name: 'main'
        baseUrl: "#{JS_DIR}"
        mainConfigFile: "#{JS_DIR}/main.js"
        out: "#{DEPLOY_APP_DIR}/main.js"
        optimize: 'none'
        onModuleBundleComplete: ((data) ->

            cleaned = amdclean.clean({
                transformAMDChecks: true
                filePath: "#{DEPLOY_APP_DIR}/main.js"
                wrap: {
                    start: '(function() { var google_code_prettify; '
                    end: '}());'
                }
            })

            fs.writeFile("#{DEPLOY_APP_DIR}/main.js", cleaned, cb)
        )
    })
gfranko commented 9 years ago

Could you send the entire module code/codebase that you are using with the require('google-code-prettify') so that I can debug more?

lookfirst commented 9 years ago

Sorry for the long delay. I setup a small project to show you how this bug happens.

https://gist.github.com/lookfirst/64def911d1a9083a2643

It is uploaded to the gist as a .zip file (sorry, github doesn't allow attaching files to issues).

  1. unzip it
  2. npm install
  3. ./node_modules/.bin/gulp heroku
  4. ctrl-c

Look at target/app/main.js. You'll notice that google_code_prettify isn't added to the list of variables on line 6.

gfranko commented 9 years ago

I'll make sure to figure this out soon.