Closed HarminderSethi closed 8 months ago
gulp file
"use strict"; const path = require("path"); const build = require("@microsoft/sp-build-web");
build.addSuppression(Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.
);
var getTasks = build.rig.getTasks; build.rig.getTasks = function () { var result = getTasks.call(build.rig);
result.set("serve", result.get("serve-deprecated"));
return result; };
/ fast-serve / const { addFastServe } = require("spfx-fast-serve-helpers"); addFastServe(build); / end of fast-serve /
build.configureWebpack.mergeConfig({ additionalConfiguration: (generatedConfiguration) => { // mgt related loaders generatedConfiguration.module.rules.push({ test: /.js|.jsx$/,
// only run on lit packages in the root node_module folder
include: [
path.resolve(__dirname, "./node_modules/@lit"),
path.resolve(__dirname, "./node_modules/lit"),
path.resolve(__dirname, "./node_modules/lit-html"),
],
use: {
loader: "babel-loader",
options: {
plugins: [
"@babel/plugin-transform-optional-chaining",
"@babel/plugin-transform-nullish-coalescing-operator",
"@babel/plugin-transform-logical-assignment-operators",
],
},
},
});
return generatedConfiguration;
}, }); build.initialize(require("gulp"));
Since the changes for gulpfile.js
are introduced inside build.configureWebpack.mergeConfig
, then you need to apply corresponding changes inside webpack.extend.js
. Read more here on how to create webpack.extend.js
, if it's not created for you.
Then put below config into the file:
const webpackConfig = {
module: {
rules: [{
test: /\.js$/,
include: [
/lit/,
/@lit/,
/lit-html/
],
use: {
loader: 'babel-loader',
options: {
plugins: [
'@babel/plugin-transform-optional-chaining',
'@babel/plugin-transform-nullish-coalescing-operator',
'@babel/plugin-transform-logical-assignment-operators'
]
}
}
}]
}
}
@s-KaiNet Thanks for the help. It works fine now. I should have read the documentation first :)
Hi,
While using mgt-graph toolkit components , fast serve throw below error. although the solution provided in https://github.com/microsoftgraph/microsoft-graph-toolkit/issues/3055 works with gulp serve but fast serve still breaks.
ERROR in ./node_modules/lit-html/directives/class-map.js 6:106 Module parse failed: Unexpected token (6:106) 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 | Copyright 2018 Google LLC | SPDX-License-Identifier: BSD-3-Clause
ERROR in ./node_modules/lit-html/directives/if-defined.js 6:16 Module parse failed: Unexpected token (6:16) 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 | Copyright 2018 Google LLC | SPDX-License-Identifier: BSD-3-Clause
ERROR in ./node_modules/lit-element/lit-element.js 6:194 Module parse failed: Unexpected token (6:194) 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 | Copyright 2017 Google LLC | SPDX-License-Identifier: BSD-3-Clause
ERROR in ./node_modules/lit-html/lit-html.js 6:302 Module parse failed: Unexpected token (6:302) 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 | SPDX-License-Identifier: BSD-3-Clause | /
ERROR in ./node_modules/@lit/task/task.js 6:421 Module parse failed: Unexpected token (6:421) 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 | Copyright 2017 Google LLC | SPDX-License-Identifier: BSD-3-Clause
ERROR in ./node_modules/@lit/reactive-element/decorators/query-assigned-nodes.js 6:47 Module parse failed: Unexpected token (6:47) 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 | Copyright 2017 Google LLC | SPDX-License-Identifier: BSD-3-Clause
ERROR in ./node_modules/@lit/reactive-element/decorators/query-assigned-elements.js 6:58 Module parse failed: Unexpected token (6:58) 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 | Copyright 2021 Google LLC | SPDX-License-Identifier: BSD-3-Clause
ERROR in ./node_modules/@lit/reactive-element/decorators/query.js 6:59 Module parse failed: Unexpected token (6:59) 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 | Copyright 2017 Google LLC | SPDX-License-Identifier: BSD-3-Clause
ERROR in ./node_modules/@lit/reactive-element/reactive-element.js 6:629 Module parse failed: Unexpected token (6:629) 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 | Copyright 2017 Google LLC | SPDX-License-Identifier: BSD-3-Clause
ERROR in ./node_modules/lit-html/directives/repeat.js 7:513 Module parse failed: Unexpected token (7:513) 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 | SPDX-License-Identifier: BSD-3-Clause | /
ERROR in ./node_modules/@lit/reactive-element/decorators/query-all.js 7:69 Module parse failed: Unexpected token (7:69) 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 | SPDX-License-Identifier: BSD-3-Clause | /
ERROR in ./node_modules/@lit/reactive-element/decorators/query-async.js 7:95 Module parse failed: Unexpected token (7:95) 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 | SPDX-License-Identifier: BSD-3-Clause | /