-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Node.js-native ECMAScript modules
- Loading branch information
Showing
122 changed files
with
393 additions
and
427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import babel from '@rollup/plugin-babel'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import nodeResolve from '@rollup/plugin-node-resolve'; | ||
import replace from '@rollup/plugin-replace'; | ||
import copy from 'rollup-plugin-copy'; | ||
import esbuild from 'rollup-plugin-esbuild'; | ||
import scss from 'rollup-plugin-scss'; | ||
import * as sass from 'sass'; | ||
|
||
const serverBundle = { | ||
input: 'src/server/app.js', | ||
output: { | ||
file: 'built/main.js', | ||
sourcemap: 'inline' | ||
}, | ||
external: [ | ||
'classnames', | ||
'express', | ||
'express-handlebars', | ||
'express-session', | ||
'morgan', | ||
'node:http', | ||
'node:path', | ||
'node:url', | ||
'prop-types', | ||
'react', | ||
'react-bootstrap-typeahead', | ||
'react-dom/server', | ||
'react-helmet', | ||
'react-redux', | ||
'react-router-dom', | ||
'react-router-dom/server.js', | ||
'redux', | ||
'redux-thunk' | ||
], | ||
watch: { | ||
clearScreen: false | ||
}, | ||
plugins: [ | ||
esbuild({ | ||
jsxFactory: 'React.createElement', | ||
jsxFragment: 'React.Fragment' | ||
}), | ||
copy({ | ||
targets: [ | ||
{ src: './src/client/assets/favicon.ico', dest: 'built/assets' } | ||
] | ||
}) | ||
] | ||
}; | ||
|
||
const clientScriptsBundle = { | ||
input: 'src/react/client-mount.jsx', | ||
output: { | ||
file: 'public/main.js', | ||
format: 'iife' | ||
}, | ||
watch: { | ||
clearScreen: false | ||
}, | ||
plugins: [ | ||
nodeResolve({ | ||
browser: true, | ||
extensions: ['.js', '.jsx'] | ||
}), | ||
babel({ | ||
babelHelpers: 'bundled', | ||
presets: ['@babel/preset-react'], | ||
extensions: ['.js', '.jsx'] | ||
}), | ||
commonjs(), | ||
replace({ | ||
preventAssignment: false, | ||
'process.env.NODE_ENV': JSON.stringify('development') | ||
}) | ||
] | ||
}; | ||
|
||
const clientStylesBundle = { | ||
input: 'src/client/stylesheets/index.scss', | ||
output: { | ||
dir: 'public' | ||
}, | ||
watch: { | ||
clearScreen: false | ||
}, | ||
plugins: [ | ||
scss({ | ||
fileName: 'main.css', | ||
failOnError: true, | ||
sass | ||
}) | ||
] | ||
}; | ||
|
||
export default [ | ||
serverBundle, | ||
clientScriptsBundle, | ||
clientStylesBundle | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.