Skip to content
This repository was archived by the owner on Feb 1, 2019. It is now read-only.

Conversation

@contolini
Copy link
Member

By pointing package.json's main property to the ES6 source code,
external projects that use this module have to ensure they transpile
the code before publishing it. It's better practice to pre-transpile
everything to a lib/ dir and set it as main so that other projects
can consume it hassle-free.

https://stackoverflow.com/a/33976278

By pointing package.json's `main` property to the ES6 source code,
external projects that use this module have to ensure they transpile
the code before publishing it. It's better practice to pre-transpile
everything to a lib/ dir and set it as `main` so that other projects
can consume it hassle-free.

https://stackoverflow.com/a/33976278
'BlackBerry 7',
'BlackBerry 10'
]
browsers: config.supportedBrowsers
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the browser list into the config file.

new webpack.optimize.UglifyJsPlugin( {
compress: { warnings: true }
} )
]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the minification step because IMHO it's premature optimization. This package isn't used on its own -- it's consumed by other projects -- so I think it's appropriate to leave minification to the consumer. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One reason to keep it may be to keep the build process as close to other projects as possible, which will make it easier to update them all. Having recently updated webpack in CF, DM, and here it helps if the config looks and acts the same.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid point. I think I'd prefer to remove it from most of our projects. It often makes development harder by obfuscating the transpiled code. For example, when I write JS for cfgov-refresh I find myself temporarily commenting out the uglify step to make debugging IE a lot easier. It seems like the sort of thing that should be in a deployment pipeline job or a separate gulp task or something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, we were having this discussion in CF a little while ago (b/c I crushed the unminified version 😛 ). The way I've been seeing to do this is set NODE_ENV and have a development and production setting https://stackoverflow.com/questions/25956937/how-to-build-minified-and-uncompressed-bundle-with-webpack

webpack has a flag for the environment too https://webpack.js.org/api/cli/#environment-options

In that setup each project has a set of environment settings and while some may omit one pathway, the pathways they share could be the same.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm definitely on board with this. Do we have it saved somewhere so it doesn't get lost to the ether?

compress: { warnings: true }
} )
]
filename: 'index.js'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed the transpiled file from main to index to match the src file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants