feat: support scope hosting (`options.?`)
currently with webpack3 (unlike rollup) you can't do import {version} from './package.json'; this tries to fix that erring on the side of only including names for export when possible, it might make sense to be put behind a flag for now
see proj4js/proj4js#261
Wow just stumbled across this thanks to a tweet. Let's see if we can make this possible. Tricky, but why not. @webpack-contrib/admin-team this would be an awesome win for folks. We should try and help facilitate this change.
so the main issue as far as I can tell is that the loader doesn't know what is being imported necessarily so we just have to proactively export as many legal identifiers as possible.
json-loader still needs to support webpack =< v1.0.0 in the current semver range and I'm uncertain if modularization should be the default for the loader. For config files mandatory to be JSON (e.g package.json) this makes sense, but in case it is up to the user to choose the format => just use a .js file instead. This only works with webpack >=v2.0.0 (ES2015 Module Support && Tree Shaking) and therefore needs to be guarded against lower versions of webpack or released as 🏷 Major. Maybe this is even better implemented as a separate loader e.g (package-json-loader || config-loader...) instead. Using export default {json} is a breaking change nevertheless => require('file.json') => require('file.json').default