Skip to content

Commit

Permalink
adds common-js dist binary webpack build
Browse files Browse the repository at this point in the history
adds mirador3-e2e-tests package
  • Loading branch information
christopher-johnson committed Dec 2, 2018
1 parent 9add11e commit 3e56ceb
Show file tree
Hide file tree
Showing 27 changed files with 25,824 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ coverage
# production
lib
build
dist

# misc
.DS_Store
Expand Down
1 change: 1 addition & 0 deletions packages/mirador3-app/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
config/
dist/
scripts/
coverage/
2 changes: 2 additions & 0 deletions packages/mirador3-app/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ module.exports = {
dotenv: resolveApp('.env'),
appPath: resolveApp('.'),
appBuild: resolveApp('build'),
appDist: resolveApp('dist'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveModule(resolveApp, 'src/index'),
appDistIndexJs: resolveModule(resolveApp, 'src/index-dist'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
appTsConfig: resolveApp('tsconfig.json'),
Expand Down
50 changes: 50 additions & 0 deletions packages/mirador3-app/config/webpack.config.dist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
process.env.BABEL_ENV = 'production';
process.env.NODE_ENV = 'production';

require('./env');
const paths = require('./paths');

module.exports = {
mode: 'production',
entry: [paths.appDistIndexJs],
output: {
path: paths.appDist,
filename: 'mirador.bundle.js',
libraryTarget: 'umd',
library: 'Mirador',
libraryExport: 'default',
},
resolve: { extensions: ['.js'] },
module: {
rules: [
{
oneOf: [
{
test: /\.js?$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
},
{
test: /\.scss$/,
use: [
'style-loader', // creates style nodes from JS strings
'css-loader', // translates CSS into CommonJS
'sass-loader', // compiles Sass to CSS, using Node Sass by default
],
},
{
loader: require.resolve('file-loader'),
// Exclude `js` files to keep "css" loader working as it injects
// it's runtime that would otherwise be processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders.
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
options: {
name: 'static/media/[name].[hash:8].[ext]',
},
},
],
},
],
},
};
4 changes: 2 additions & 2 deletions packages/mirador3-app/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ module.exports = {
// https://github.com/facebook/create-react-app/issues/253
modules: ['node_modules'].concat(
// It is guaranteed to exist because we tweak it in `env.js`
process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
process.env.NODE_PATH.split(path.delimiter).filter(Boolean),
),
// These are the reasonable defaults supported by the Node ecosystem.
// We also include JSX as a common component filename extension to support
Expand Down Expand Up @@ -394,7 +394,7 @@ module.exports = {
modules: true,
getLocalIdent: getCSSModuleLocalIdent,
},
'sass-loader'
'sass-loader',
),
},
// "file" loader makes sure assets end up in the `build` folder.
Expand Down
Loading

0 comments on commit 3e56ceb

Please sign in to comment.