Skip to content

Update website to Webpack v3 #5725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 5, 2018
Merged

Conversation

pshrmn
Copy link
Contributor

@pshrmn pshrmn commented Nov 13, 2017

I'd also like to get rid of those inline loaders, but that wasn't as straightforward, so I skipped it for the time being.

@timdorr
Copy link
Member

timdorr commented Nov 14, 2017

Can't we set up a loader rule scoped to just that path?

I also wonder if we can get rid of some of the relative pathing all over the place by providing a base path at the repo root. That gets tedious after a while.

@pshrmn
Copy link
Contributor Author

pshrmn commented Nov 14, 2017

I was staring at that config for a bit trying to figure out why the website is importing the same file twice.

load: require('bundle?lazy!babel!../examples/Basic'),
loadSource: require('bundle?lazy!!prismjs?lang=jsx!../examples/Basic.js')

load is loading the actual code, while loadSource is reading the source code and passing that to PrismJS to render as HTML. We should be able to use resourceQuery to get this working in a Webpack configuration file.

load: require('bundle?lazy!babel!../examples/Basic'),
loadSource: require('bundle?lazy!!prismjs?lang=jsx!../examples/Basic.js')
load: require('../examples/Basic?bundle'),
loadSource: require('../examples/Basic.js?prismjs')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This configuration has been moved to the Webpack config. Because we are loading one file two different ways, we need to use a resource query to differentiate between when to read it as JavaScript and when to read it as a string to markup.

const Prism = require('prismjs');

module.exports = function loader(content) {
const query = this.query
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving the configuration to the Webpack config broke the prismjs-loader. I will probably look into making a PR for this (I think it is a simple fix, but I'll have to run some tests), but I included the updated source here so that we don't have to wait for that to happen.

@@ -0,0 +1,26 @@
// modified version of https://github.com/valor-software/prismjs-loader
'use strict';
const Prism = require('prismjs');
Copy link
Member

Choose a reason for hiding this comment

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

I don't see a prismjs dep. Even if it's implicitly available, I'd rather it be an explicit dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Come to think of it, my local build probably only worked because prismjs was still installed.

@timdorr
Copy link
Member

timdorr commented Nov 14, 2017

We should be able to add a resolve.modules config to get rid of the extreme relative pathing too.

@timdorr
Copy link
Member

timdorr commented Dec 13, 2017

Is this g2g?

@pshrmn
Copy link
Contributor Author

pshrmn commented Dec 13, 2017

I want to say yes, but I'll need to take another look at it.

@pshrmn
Copy link
Contributor Author

pshrmn commented Dec 13, 2017

Alright, everything should be good. I just updated the various Webpack deps to their @latest versions.

I never heard a peep on my PR for updating the prismjs-loader, so it looks like we have to use the clone for the time being. I'm not actually sure what the correct thing to with the license is; should the copyright be listed at the top of that file or is a link to the original source good?

@timdorr
Copy link
Member

timdorr commented Dec 13, 2017

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

I'd throw the license in as a comment at the top.

@timdorr
Copy link
Member

timdorr commented Jan 5, 2018

I think this is all good to go, right?

@pshrmn
Copy link
Contributor Author

pshrmn commented Jan 5, 2018

Yes

@timdorr
Copy link
Member

timdorr commented Jan 5, 2018

Make it so.

@timdorr timdorr merged commit c63f56d into remix-run:master Jan 5, 2018
@pshrmn pshrmn deleted the webpack-website branch January 5, 2018 21:16
jeresig pushed a commit to Khan/react-router that referenced this pull request Aug 29, 2018
* Update website to Webpack v3

* Move bundle loaders to Webpack config

* Add prismjs devDep

* +resolve.modules, -dot-dots

* Latest deps

* Add prismjs-loader license
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
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.

2 participants