Using Imports with .Net, React.Js, and Url.ContentSending email in .NET through GmailHow to escape braces (curly brackets) in a format string in .NET.NET String.Format() to add commas in thousands place for a numberWhy is it important to override GetHashCode when Equals method is overridden?Difference between decimal, float and double in .NET?How can I get the application's path in a .NET console application?Perform debounce in React.jsUnderstanding unique keys for array children in React.jsWebpack throws syntax error for JSXWebpack css issue, missing bundle.css

Why didn't Boeing produce its own regional jet?

Venezuelan girlfriend wants to travel the USA to be with me. What is the process?

One verb to replace 'be a member of' a club

Is it possible to create a QR code using text?

Im going to France and my passport expires June 19th

Should I cover my bicycle overnight while bikepacking?

Is there an expression that means doing something right before you will need it rather than doing it in case you might need it?

Bullying boss launched a smear campaign and made me unemployable

Unlock My Phone! February 2018

What exploit Are these user agents trying to use?

Why was the shrinking from 8″ made only to 5.25″ and not smaller (4″ or less)?

How badly should I try to prevent a user from XSSing themselves?

Would Slavery Reparations be considered Bills of Attainder and hence Illegal?

Examples of smooth manifolds admitting inbetween one and a continuum of complex structures

Can a virus destroy the BIOS of a modern computer?

How writing a dominant 7 sus4 chord in RNA ( Vsus7 chord in the 1st inversion)

Why do bosons tend to occupy the same state?

How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?

What's the in-universe reasoning behind sorcerers needing material components?

Assassin's bullet with mercury

A category-like structure without composition?

Little known, relatively unlikely, but scientifically plausible, apocalyptic (or near apocalyptic) events

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

What about the virus in 12 Monkeys?



Using Imports with .Net, React.Js, and Url.Content


Sending email in .NET through GmailHow to escape braces (curly brackets) in a format string in .NET.NET String.Format() to add commas in thousands place for a numberWhy is it important to override GetHashCode when Equals method is overridden?Difference between decimal, float and double in .NET?How can I get the application's path in a .NET console application?Perform debounce in React.jsUnderstanding unique keys for array children in React.jsWebpack throws syntax error for JSXWebpack css issue, missing bundle.css













0















I am using a .Net MVC framework, and trying to render a jsx (React) file that has imports. I am including this file in the razor page (cshtml) through the standard Url.Content injection as follows:



<script src="@Url.Content("~/js/queue/QueueIndex.js")"></script>
<script>
ReactDOM.render(React.createElement(QueueIndex), document.getElementById("queue-index"));

jQuery(window).on("load scroll", function ()
'use strict'; // Start of use strict
// Loader
$("#dvLoading").fadeOut("fast");
);
</script>


If I do not have an import at the top of my React file (QueueIndex.jsx) the page loads just fine. However, I would like to import the react-table package, but if include any imports in my QueueIndex.jsx file, the page breaks.



The error I'm getting is require is not defined.



I think the solution is somewhere in the use of webpack, here is my config:



const webpack = require("webpack");
const CleanWebpackPlugin = require('clean-webpack-plugin');

module.exports =
entry:
nhqueue: './wwwroot/js/queue/QueueIndex.jsx'
,
output:
path: __dirname + '/wwwroot/js/',
publicPath: '/wwwroot/js/',
filename: '[name].bundle.js'
,
module:
preLoaders: [
],
loaders: [

test: /.css$/,
loader: "style-loader!css-loader"
,
test: /.tsx?$/, loaders: ['babel', 'ts'] ,
test: /.json$ /, loader: "json-loader" ,

test: /.jsx?$/,
exclude: /node_modules/,
loader: "babel",
query:

presets: ['react']


],
externals:
"moment": "moment",
,
,
devtool: 'source-map',
target: 'web',
plugins: [
new CleanWebpackPlugin(['./wwwroot/js/*.js'],
root: __dirname,
verbose: true,
dry: false
),
new webpack.DefinePlugin(
'process.env':
NODE_ENV: JSON.stringify('production')

),
new webpack.optimize.UglifyJsPlugin()
],
resolve:
extensions: ['', '.jsx', '.js', '.tsx', '.ts']
,
node:
fs: "empty",
child_process: "empty"




Unfortunately, I have had no luck there. Please let me know if you have any ideas of how to resolve this issue. Thanks!



Also, Here is the Babel configuration:



"presets" : ["es2015", "react"]









share|improve this question
























  • Can you add more details? Do you get this error on the Webpack build? Runtime? How babel is configured?

    – EladBash
    Mar 7 at 23:45











  • Hi, so I get there error on runtime (like in the console). I have added my babelrc file to the question, if that's what you are looking for?

    – Austin Wrenn
    Mar 8 at 1:27











  • I am just quessing .. you are including queueIndex.js, but such file should not exist (probably babel temp file). Based on your webpack config the js file should be /js/nhqueue.bundle.js

    – Ondra
    Mar 8 at 19:29















0















I am using a .Net MVC framework, and trying to render a jsx (React) file that has imports. I am including this file in the razor page (cshtml) through the standard Url.Content injection as follows:



<script src="@Url.Content("~/js/queue/QueueIndex.js")"></script>
<script>
ReactDOM.render(React.createElement(QueueIndex), document.getElementById("queue-index"));

jQuery(window).on("load scroll", function ()
'use strict'; // Start of use strict
// Loader
$("#dvLoading").fadeOut("fast");
);
</script>


If I do not have an import at the top of my React file (QueueIndex.jsx) the page loads just fine. However, I would like to import the react-table package, but if include any imports in my QueueIndex.jsx file, the page breaks.



The error I'm getting is require is not defined.



I think the solution is somewhere in the use of webpack, here is my config:



const webpack = require("webpack");
const CleanWebpackPlugin = require('clean-webpack-plugin');

module.exports =
entry:
nhqueue: './wwwroot/js/queue/QueueIndex.jsx'
,
output:
path: __dirname + '/wwwroot/js/',
publicPath: '/wwwroot/js/',
filename: '[name].bundle.js'
,
module:
preLoaders: [
],
loaders: [

test: /.css$/,
loader: "style-loader!css-loader"
,
test: /.tsx?$/, loaders: ['babel', 'ts'] ,
test: /.json$ /, loader: "json-loader" ,

test: /.jsx?$/,
exclude: /node_modules/,
loader: "babel",
query:

presets: ['react']


],
externals:
"moment": "moment",
,
,
devtool: 'source-map',
target: 'web',
plugins: [
new CleanWebpackPlugin(['./wwwroot/js/*.js'],
root: __dirname,
verbose: true,
dry: false
),
new webpack.DefinePlugin(
'process.env':
NODE_ENV: JSON.stringify('production')

),
new webpack.optimize.UglifyJsPlugin()
],
resolve:
extensions: ['', '.jsx', '.js', '.tsx', '.ts']
,
node:
fs: "empty",
child_process: "empty"




Unfortunately, I have had no luck there. Please let me know if you have any ideas of how to resolve this issue. Thanks!



Also, Here is the Babel configuration:



"presets" : ["es2015", "react"]









share|improve this question
























  • Can you add more details? Do you get this error on the Webpack build? Runtime? How babel is configured?

    – EladBash
    Mar 7 at 23:45











  • Hi, so I get there error on runtime (like in the console). I have added my babelrc file to the question, if that's what you are looking for?

    – Austin Wrenn
    Mar 8 at 1:27











  • I am just quessing .. you are including queueIndex.js, but such file should not exist (probably babel temp file). Based on your webpack config the js file should be /js/nhqueue.bundle.js

    – Ondra
    Mar 8 at 19:29













0












0








0


1






I am using a .Net MVC framework, and trying to render a jsx (React) file that has imports. I am including this file in the razor page (cshtml) through the standard Url.Content injection as follows:



<script src="@Url.Content("~/js/queue/QueueIndex.js")"></script>
<script>
ReactDOM.render(React.createElement(QueueIndex), document.getElementById("queue-index"));

jQuery(window).on("load scroll", function ()
'use strict'; // Start of use strict
// Loader
$("#dvLoading").fadeOut("fast");
);
</script>


If I do not have an import at the top of my React file (QueueIndex.jsx) the page loads just fine. However, I would like to import the react-table package, but if include any imports in my QueueIndex.jsx file, the page breaks.



The error I'm getting is require is not defined.



I think the solution is somewhere in the use of webpack, here is my config:



const webpack = require("webpack");
const CleanWebpackPlugin = require('clean-webpack-plugin');

module.exports =
entry:
nhqueue: './wwwroot/js/queue/QueueIndex.jsx'
,
output:
path: __dirname + '/wwwroot/js/',
publicPath: '/wwwroot/js/',
filename: '[name].bundle.js'
,
module:
preLoaders: [
],
loaders: [

test: /.css$/,
loader: "style-loader!css-loader"
,
test: /.tsx?$/, loaders: ['babel', 'ts'] ,
test: /.json$ /, loader: "json-loader" ,

test: /.jsx?$/,
exclude: /node_modules/,
loader: "babel",
query:

presets: ['react']


],
externals:
"moment": "moment",
,
,
devtool: 'source-map',
target: 'web',
plugins: [
new CleanWebpackPlugin(['./wwwroot/js/*.js'],
root: __dirname,
verbose: true,
dry: false
),
new webpack.DefinePlugin(
'process.env':
NODE_ENV: JSON.stringify('production')

),
new webpack.optimize.UglifyJsPlugin()
],
resolve:
extensions: ['', '.jsx', '.js', '.tsx', '.ts']
,
node:
fs: "empty",
child_process: "empty"




Unfortunately, I have had no luck there. Please let me know if you have any ideas of how to resolve this issue. Thanks!



Also, Here is the Babel configuration:



"presets" : ["es2015", "react"]









share|improve this question
















I am using a .Net MVC framework, and trying to render a jsx (React) file that has imports. I am including this file in the razor page (cshtml) through the standard Url.Content injection as follows:



<script src="@Url.Content("~/js/queue/QueueIndex.js")"></script>
<script>
ReactDOM.render(React.createElement(QueueIndex), document.getElementById("queue-index"));

jQuery(window).on("load scroll", function ()
'use strict'; // Start of use strict
// Loader
$("#dvLoading").fadeOut("fast");
);
</script>


If I do not have an import at the top of my React file (QueueIndex.jsx) the page loads just fine. However, I would like to import the react-table package, but if include any imports in my QueueIndex.jsx file, the page breaks.



The error I'm getting is require is not defined.



I think the solution is somewhere in the use of webpack, here is my config:



const webpack = require("webpack");
const CleanWebpackPlugin = require('clean-webpack-plugin');

module.exports =
entry:
nhqueue: './wwwroot/js/queue/QueueIndex.jsx'
,
output:
path: __dirname + '/wwwroot/js/',
publicPath: '/wwwroot/js/',
filename: '[name].bundle.js'
,
module:
preLoaders: [
],
loaders: [

test: /.css$/,
loader: "style-loader!css-loader"
,
test: /.tsx?$/, loaders: ['babel', 'ts'] ,
test: /.json$ /, loader: "json-loader" ,

test: /.jsx?$/,
exclude: /node_modules/,
loader: "babel",
query:

presets: ['react']


],
externals:
"moment": "moment",
,
,
devtool: 'source-map',
target: 'web',
plugins: [
new CleanWebpackPlugin(['./wwwroot/js/*.js'],
root: __dirname,
verbose: true,
dry: false
),
new webpack.DefinePlugin(
'process.env':
NODE_ENV: JSON.stringify('production')

),
new webpack.optimize.UglifyJsPlugin()
],
resolve:
extensions: ['', '.jsx', '.js', '.tsx', '.ts']
,
node:
fs: "empty",
child_process: "empty"




Unfortunately, I have had no luck there. Please let me know if you have any ideas of how to resolve this issue. Thanks!



Also, Here is the Babel configuration:



"presets" : ["es2015", "react"]






javascript c# .net reactjs razor-pages






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 1:28







Austin Wrenn

















asked Mar 7 at 22:39









Austin WrennAustin Wrenn

11516




11516












  • Can you add more details? Do you get this error on the Webpack build? Runtime? How babel is configured?

    – EladBash
    Mar 7 at 23:45











  • Hi, so I get there error on runtime (like in the console). I have added my babelrc file to the question, if that's what you are looking for?

    – Austin Wrenn
    Mar 8 at 1:27











  • I am just quessing .. you are including queueIndex.js, but such file should not exist (probably babel temp file). Based on your webpack config the js file should be /js/nhqueue.bundle.js

    – Ondra
    Mar 8 at 19:29

















  • Can you add more details? Do you get this error on the Webpack build? Runtime? How babel is configured?

    – EladBash
    Mar 7 at 23:45











  • Hi, so I get there error on runtime (like in the console). I have added my babelrc file to the question, if that's what you are looking for?

    – Austin Wrenn
    Mar 8 at 1:27











  • I am just quessing .. you are including queueIndex.js, but such file should not exist (probably babel temp file). Based on your webpack config the js file should be /js/nhqueue.bundle.js

    – Ondra
    Mar 8 at 19:29
















Can you add more details? Do you get this error on the Webpack build? Runtime? How babel is configured?

– EladBash
Mar 7 at 23:45





Can you add more details? Do you get this error on the Webpack build? Runtime? How babel is configured?

– EladBash
Mar 7 at 23:45













Hi, so I get there error on runtime (like in the console). I have added my babelrc file to the question, if that's what you are looking for?

– Austin Wrenn
Mar 8 at 1:27





Hi, so I get there error on runtime (like in the console). I have added my babelrc file to the question, if that's what you are looking for?

– Austin Wrenn
Mar 8 at 1:27













I am just quessing .. you are including queueIndex.js, but such file should not exist (probably babel temp file). Based on your webpack config the js file should be /js/nhqueue.bundle.js

– Ondra
Mar 8 at 19:29





I am just quessing .. you are including queueIndex.js, but such file should not exist (probably babel temp file). Based on your webpack config the js file should be /js/nhqueue.bundle.js

– Ondra
Mar 8 at 19:29












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053956%2fusing-imports-with-net-react-js-and-url-content%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053956%2fusing-imports-with-net-react-js-and-url-content%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved