-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Universal Webpack #3578
Universal Webpack #3578
Conversation
…l-webpack # Conflicts: # server/build/plugins/combine-assets-plugin.js
…s-for-plugins # Conflicts: # server/build/plugins/combine-assets-plugin.js
# Conflicts: # yarn.lock
But super slow and no HMR support.
wow this is great! i'm trying to get the scss to work. the links in the readme point to a private (?) repo so i can't find an example snippet. i already added this to my
|
never mind, i had forgotten to add |
For me the same config of @mgiraldo fails and not sure why, getting this error:
|
Note that this is not released just yet. Only merged into the canary branch. I'll make the next-plugins more resilient against older versions so that they'll error out 👍 Keep an eye out for https://github.com/zeit/next.js/releases 🙏 |
Using "webpack" config function defined in next.config.js. I am getting the same issue. "next": "^4.2.3". I tried with "next": "^4.4.0-canary.3" as well, got the same error |
@timneutkens It seems that this PR is about an issue I've just encountered while importing a .css file. I've followed this guide of your official repo and received:
Will the next release (with this PR) fix the issue? |
Looks like |
Note that this is not released just yet. as said above |
@timneutkens I know, that's why I asked:
|
Of course @julmot, ZEIT team won't release things with known issues. Just let them finish their work and please file an issue if you encounter any problems when this will be officially released. 💟 |
@Thesuperfly I wasn't thinking so. I'm interested if the thing I was mentioning is covered in this PR. That's all. And my question is still open. |
i guess you should wait for the release and see then, @julmot |
@julmot to answer your question. Yes. I've also updated all next-plugins with a check for v5+ so that they error out till the work in this PR is released. Just a few more things 🙏Thanks for your patience! |
Congrats on release! Any plans for |
@ilionic feel free to create a plugin in github.com/zeit/next-plugins. You can almost copy-paste the sass or less one. |
i'm trying to use css and scss simultaneously (especially for ant-d usecase), i duplicate |
it seems can't understand what |
Sounds like the loader isn't being applied. Either way not a Next.js issue, since we don't do anything related to styles in Next. I'm guessing it's because of something specific with antd and css-loader 🤔 |
"next": "5.1.0", next.config.js module.exports = withCSS({
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
}, |
css-modules
is also support with a flag. Fixes Working with external css and scss files #3131, with-global-stylesheet-simple < multiple files #3239, Extracted static stylesheet file into header #2534, How to minimize css when import to comoponent? #3465, isomorphic-style-loader example #1615, use with-external-scoped-css dont support import css in need? #3143, Need update in example code about external stylesheet #2413, Working with external css and scss files #3131, Can't build application with sass files, which are working on development #3519, The example "with-external-scoped-css" works randomly #3276, @font-face SyntaxError: Invalid or unexpected token #3408.js,.jsx,.ts,.tsx
Fixes Custom extensions with priority #3445, Allow custom extensions (.ts .tsx .jsx) #2391preact
and any other React clone that supports server side rendering. Fixes React Alias #1564I'm going to add more issues here whenever I come across one fitting this pull request.
Webpack for Client / Server Side
Webpack is now being used to transpile the server side code too. This new feature is mostly backwards compatible. The main user facing difference is that
webpack
innext.config.js
is now being ran twice, once for the server and once for the client allowing configuration to differ for client and server rendering. This differentiation is marked by a new propertyisServer
passed to thewebpack
function. All properties are outlined below:CSS / SASS / LESS
For importing
.css
.scss
or.less
we’ve created modules which have sane defaults for server side rendering.CSS modules
Optionally you can enable css modules using
cssModules: true
, which works withwithSass
andwithLess
too.sass support
less support
Typescript
npm install --save @zeit/next-typescript typescript
Create a
next.config.js
Then create a
tsconfig.json
in your projectCreate pages in the
pages
directorypreact
With universal webpack and the upgrade to react-hot-loader v4
preact
is now easily configuredSource Maps
Next is configured to serve the
.js.map
route for bundled files. You can enable them in production usingnext.config.js