Code Monkey home page Code Monkey logo

nextjs-ts's People

Contributors

dependabot[bot] avatar sanjaytwisk avatar sobolevn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nextjs-ts's Issues

svg sprite #undefined when install next-images ? Help me

const {
PHASE_DEVELOPMENT_SERVER,
PHASE_PRODUCTION_BUILD,
} = require('next/constants')

const getBuildConfig = (...args) => {
const path = require('path')
const withPugins = require('next-compose-plugins')
const withCSS = require('@zeit/next-css')
const withFonts = require('next-fonts')
const withImages = require('next-images')
const withSCSS = require('@zeit/next-sass')
const postcssPresetEnv = require('postcss-preset-env')
const postcssPresetEnvOptions = {
features: {
'custom-media-queries': true,
'custom-selectors': true,
},
}

const cssOptions = {
postcssLoaderOptions: {
plugins: [postcssPresetEnv(postcssPresetEnvOptions)],
},
sassLoaderOptions: {
includePaths: [path.join(process.cwd(), 'src', 'common', 'scss')],
},
}

const nextConfig = {
webpack(config) {
config.module.rules.push({
test: /.svg$/,
include: /src/common/icon/icons/,
use: [
'svg-sprite-loader',
{
loader: 'svgo-loader',
options: {
plugins: [
{ removeAttrs: { attrs: '(fill)' } },
{ removeTitle: true },
{ cleanupIDs: true },
{ removeStyleElement: true },
],
},
},
],
})
return config
},
}
return withPugins(
[[withSCSS, cssOptions], withFonts, [withImages], withCSS],
nextConfig
)(...args)
}

module.exports = (phase, ...rest) => {
const shouldAddBuildConfig =
phase === PHASE_DEVELOPMENT_SERVER || phase === PHASE_PRODUCTION_BUILD
return shouldAddBuildConfig ? getBuildConfig(phase, ...rest) : {}
}
Screen Shot 2563-03-22 at 13 08 24

ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema

First time, I clone the source.
Yarn install => yarn dev.
I have error.

error - ./src/common/css/variables.scss
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.

  • options has an unknown property 'includePaths'. These properties are valid:
    object { implementation?, sassOptions?, additionalData?, sourceMap?, webpackImporter? }

how can I resolved this issue?
Thank you!
(p/s) My english is not good. I'm sorry for the inconvenience

svg sprite not working when install next-optimized-images ? Help me

const {
PHASE_DEVELOPMENT_SERVER,
PHASE_PRODUCTION_BUILD,
} = require('next/constants')

const getBuildConfig = (...args) => {
const path = require('path')
const postcssPresetEnv = require('postcss-preset-env')
const withPlugins = require('next-compose-plugins')
const optimizedImages = require('next-optimized-images');
const postcssPresetEnvOptions = {
features: {
'custom-media-queries': true,
'custom-selectors': true,
},
}

const cssOptions = {
postcssLoaderOptions: {
plugins: [postcssPresetEnv(postcssPresetEnvOptions)],
},
sassOptions: {
includePaths: [path.join(process.cwd(), 'src', 'common', 'css')],
},
}

const nextConfig = {
...cssOptions,
webpack(config) {
config.module.rules.push({
test: /.svg$/,
include: path.join(process.cwd(), 'src', 'components', 'icon', 'icons'),
use: [
'svg-sprite-loader',
{
loader: 'svgo-loader',
options: {
plugins: [
{ removeAttrs: { attrs: '(fill)' } },
{ removeTitle: true },
{ cleanupIDs: true },
{ removeStyleElement: true },
],
},
},
],
})
return config
},
}
return withPlugins([[optimizedImages, {}]], nextConfig)(...args)
}

module.exports = (phase, ...rest) => {
const shouldAddBuildConfig =
phase === PHASE_DEVELOPMENT_SERVER || phase === PHASE_PRODUCTION_BUILD
return shouldAddBuildConfig ? getBuildConfig(phase, ...rest) : {}
}
Screen Shot 2563-11-09 at 20 40 26

SVG file not working

Hi @sanjaytwisk .
I use windows 10. node v12.16.3 version
I received your feeback.
After clone latest source.

Yarn install => Yarn dev
I got another issue.

./src/components/icon/icons/plus.svg 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

|
|

Thanks @sanjaytwisk

how to make config postcss.config.js ?

next.config.js
const withCSS = require('@zeit/next-css')
return withPugins(
[
[
[
withCSS,
{
postcssLoaderOptions: {
parser: true,
config: {
ctx: {
theme: JSON.stringify(process.env.REACT_APP_THEME),
},
},
},
},
],
withSCSS,
cssOptions,
],
],
nextConfig
)(...args)

==> TypeError: parsedPhaseConfig.substr is not a function
Can you give me examples ,thanks

[Detected next.config.js, no exported configuration found] when combined and use many plugins

Hi @sanjaytwisk ,

I using next-compose-plugins and combind next-images with nextConfig.

In your next.config.js. I add some line

const withPlugins = require('next-compose-plugins'); // added
const withImage = require('next-images'); // added
// const nextConfig is here.....
I change return nextConfig to return withPlugins([[withImage, {}]], nextConfig);

I run yarn dev. I see warn Detected next.config.js, no exported configuration found

++++++++++++++++++++++++++++++++++++++++++++++++++++++
source code next.config.js

const {
PHASE_DEVELOPMENT_SERVER,
PHASE_PRODUCTION_BUILD,
} = require('next/constants')

const getBuildConfig = () => {
const path = require('path')
const postcssPresetEnv = require('postcss-preset-env')
const postcssPresetEnvOptions = {
features: {
'custom-media-queries': true,
'custom-selectors': true,
},
}

const cssOptions = {
postcssLoaderOptions: {
plugins: [postcssPresetEnv(postcssPresetEnvOptions)],
},
sassOptions: {
includePaths: [path.join(process.cwd(), 'src', 'common', 'css')],
},
}

const withPlugins = require('next-compose-plugins');
const withImage = require('next-images');

const nextConfig = {
...cssOptions,
webpack(config) {
config.module.rules.push({
test: /.svg$/,
include: path.join(process.cwd(), 'src', 'components', 'icon', 'icons'),
use: [
'svg-sprite-loader',
{
loader: 'svgo-loader',
options: {
plugins: [
{ removeAttrs: { attrs: '(fill)' } },
{ removeTitle: true },
{ cleanupIDs: true },
{ removeStyleElement: true },
],
},
},
],
})
return config
},
}
return withPlugins([[withImage, {}]], nextConfig);
}

module.exports = (phase) => {
const shouldAddBuildConfig =
phase === PHASE_DEVELOPMENT_SERVER || phase === PHASE_PRODUCTION_BUILD
return shouldAddBuildConfig ? getBuildConfig() : {}
}

Image Component next 10 not working ?

Hi, @sanjaytwisk , i use image component next 10 , but not working ? Do you help me ?

import { Icon } from '@components/icon/Icon'
import style from './style.module.scss'
import Image from 'next/image'

interface CounterProps {
count: number
add: () => void
remove: () => void
}

export const Counter: React.SFC = ({ count, add, remove }) => {
const onAdd = () => add()
const onRemove = () => remove()
return (


Count: {count}



<Icon name={'plus'} /> Add


<Icon name={'minus'} /> Remove

Picture of the author

)
}

Screen Shot 2563-11-14 at 20 53 37

icon error maybe

I'm not a developer so my troubleshooting attempts is mostly Google.
I error I get in the browser is:

./src/components/icon/icons/minus.svg
Error: Plugin name should be specified
    at Array.map (<anonymous>)

I run npm install with no issues.
I attempt to run npm run dev and get this in the terminal

./src/components/icon/icons/minus.svg
Error: Plugin name should be specified
    at Array.map (<anonymous>)

I've tried stupid things like just deleting any reference to minus.svg and then I get the error with plus.svg, so that did not work.
I see webpack is mentioned so I try to move to a lower version without success.
Any ideas?

Thanks
Paul

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.