下一个js导入scss错误(ModuleParseError:模块解析失败:意外字符'...'(1:0])

时间:2019-11-21 00:06:22

标签: reactjs sass next.js

我的问题是

当我在'ProjectFolder / components / header / Header.js'中导入如下所示的scss文件时

(Header.js位于相同的“页面”目录level.v)

import "../../public/assets/scss/_reset.scss";

enter image description here

引发此错误。

我也这样创建next.config.js。

// next.config.js setting
const withSass = require('@zeit/next-sass');
module.exports = withSass();

还有我的package.json

enter image description here

我听说'/'路径正在自动解析'public'目录...

所以我也尝试过

import "/assets/scss/_reset.scss";

但是同一期出版。

我能知道为什么吗?。

感谢您的阅读:)

2 个答案:

答案 0 :(得分:1)

我解决了这个问题!更改next.config.js!

CREATE PROCEDURE ProcInsertRecord
    @Name varchar(30),
    @mobile_no varchar(30),
    @message varchar(30),
    @Address varchar(30),
    @Designation varchar(30),
    @table sysname
    AS
    BEGIN
        -- declare your variables. Don't use nvarchar(max) unless you have to. 
        DECLARE @Sql nvarchar(4000), 
                @LineBreak nchar(2) = NCHAR(13) + NCHAR(10), 
                @ParamDefinition nvarchar(4000);

        -- White list your table name: making sure not only that it exists,
        -- but also it has all the columns you are using in your insert statement.
        IF EXISTS(
            SELECT 1
            FROM InformationSchema.Columns
            WHERE Column_Name IN('Name', 'Mobile', 'Message', 'Address', 'Designation')
            AND Table_Name = @table
            GROUP BY Table_Name
            -- This is usually count(distinct xxx), but column names are unique in a table.
            HAVING COUNT(Column_Name) = 5 
        )

        BEGIN
            -- QUOTENAME protects your query from breaking on table names with spaces or other "strage" chars in their name.
            -- Use line breaks to make your query readable.
            SET @SQL = N'INSERT INTO '+ QUOTENAME(@table) +' (Name, Mobile, Message, Address, Designation) '+ @LineBreak + 
                       N'VALUES (@Name, @mobile_no, @message, @Address, @Designation)'

            -- When dealing with dynamic SQL, print is your best friend.
            PRINT @SQL 

            SET @ParamDefinition = 
                N'@Name varchar(30),
                  @mobile_no varchar(30),
                  @message varchar(30),
                  @Address varchar(30),
                  @Designation varchar(30)'

            -- Unremark only when print displays a valid SQL.
            --EXEC sp_ExecuteSql 
            --     @SQL, 
            --     @ParamDefinition, 
            --     @Name, @mobile_no, @message, @Address, @Designation

        END
    END

答案 1 :(得分:0)

您是否使用BOM表(字节顺序标记)创建了文件 检查文件编码,并使用纯文本编辑器检查文件以删除BOM。如果文件需要使用该编码(可能是utf-8),则可以尝试使用npm中的webpack-utf8-bom