amdclean icon indicating copy to clipboard operation
amdclean copied to clipboard

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

Open lookfirst opened this issue 11 years ago • 3 comments

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)
        )
    })

lookfirst avatar Nov 01 '14 18:11 lookfirst

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

gfranko avatar Nov 18 '14 21:11 gfranko

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.

lookfirst avatar Nov 30 '14 06:11 lookfirst

I'll make sure to figure this out soon.

gfranko avatar Dec 06 '14 21:12 gfranko